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