Got the same error, and it was because of version incompatibilities between my iPhone, MacOS version and XCode version. Before I had:
macOS 13.4.1
XCode 14.3.1
iPhone 14 Pro, iOS 17.1.2
However, you must update to XCode 15+ in order to work with iOS 17+, but in order to do that, you need to upgrade macOS also. So now I am doing:
macOS 14.2.1
XCode 15.1
iPhone 14 Pro, iOS 17.1.2 (no change)