Notarization works well from the Xcode UI, but the moment you want to handle this from the command line it's mostly trial and error. At least I have a shell script now that handles all commands for me. And this support page by Apple: https://developer.apple.com/documentation/security/notarizing_your_app_before_distribution/resolving_common_notarization_issues
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!