I had the same problem and it seemed due to not having accepted all the latest developer agreements. xcrun notarytool
reported:
Error: HTTP status code: 403. A required agreement is missing or has expired. This request requires an in-effect agreement that has not been signed or has expired. Ensure your team has signed the necessary legal agreements and that they are not expired.
There was an updated agreement on https://developer.apple.com/account. Accepting this didn't seem to solve the problem, at least not after a waiting for a few minutes, so I kept looking and found the "Paid Apps" agreement on https://appstoreconnect.apple.com/agreements. I wasn't sure if it's relevant to me (I don't currently have any paid apps), but after accepting this one, notarising from Xcode worked again. However, it could be that there was just a propagation delay and that accepting the first agreement would have proved to be enough eventually.