If your device is using a managed identity - such as a corporate account / SSO - you need to be added to the Apple account for this to work. I'll write an article about this. What a nightmare. Apple should have better error messages.
Topic:
App Store Distribution & Marketing
SubTopic:
TestFlight