I got this error in XCode 15.
By archiving the project and while I clicked on distribution I choose "Custom" instead of directly hitting to "distribute/deploy on AppStore and TestFlight etc." to upload my app to the AppStore connect and I checked the first two options listed.
Worked like a charm for me!