crewAIInc/crewAI · error · ValueError
Missing required fields in OAuth2 configuration: [{', '.join
Error message
Missing required fields in OAuth2 configuration: [{', '.join(missing_basic_fields)}] What it means
Validation error from the enterprise OAuth2 discovery flow: the endpoint returned valid JSON, but the document is missing one or more of the required top-level fields — audience, domain, device_authorization_client_id, provider, extra. The message lists exactly which fields are absent. This is a server-side configuration problem, not a client input error.
Source
Thrown at lib/cli/src/crewai_cli/enterprise/main.py:111
required_fields = [
"audience",
"domain",
"device_authorization_client_id",
"provider",
"extra",
]
missing_basic_fields = [
field for field in required_fields if field not in oauth_config
]
missing_provider_specific_fields = [
field
for field in self._get_provider_specific_fields(oauth_config["provider"])
if field not in oauth_config.get("extra", {})
]
if missing_basic_fields:
raise ValueError(
f"Missing required fields in OAuth2 configuration: [{', '.join(missing_basic_fields)}]"
)
if missing_provider_specific_fields:
raise ValueError(
f"Missing authentication provider required fields in OAuth2 configuration: [{', '.join(missing_provider_specific_fields)}] (Configured provider: '{oauth_config['provider']}')"
)
def _get_provider_specific_fields(self, provider_name: str) -> list[str]:
provider = ProviderFactory.from_settings(
Oauth2Settings(provider=provider_name, client_id="dummy", domain="dummy")
)
return provider.get_required_fields()
View on GitHub (pinned to 754d7323be)
Solutions
- curl the discovery endpoint and diff the returned keys against: audience, domain, device_authorization_client_id, provider, extra
- Have the enterprise admin complete the OAuth2 provider configuration so all fields are emitted
- If keys exist under different names due to version skew, upgrade the CLI (or the server) so schemas match
- Re-run `crewai enterprise connect` after the server-side fix
Defensive patterns
Strategy: validation
Validate before calling
REQUIRED = {"audience", "domain", "device_authorization_client_id", "provider", "extra"}
def discovery_complete(doc: dict) -> bool:
return REQUIRED.issubset(doc) Type guard
def is_complete_oauth_config(value: object) -> bool:
required = {"audience", "domain", "device_authorization_client_id", "provider", "extra"}
return isinstance(value, dict) and required.issubset(value) Try / catch
try:
enterprise_cmd.connect(url)
except ValueError as e:
if "Missing required fields" in str(e):
# server-side config gap; report the listed fields to the enterprise admin
... Prevention
- curl the discovery endpoint and check all five required keys before onboarding
- Have admins fully configure the OAuth provider before inviting CLI users
- Pin CLI and server versions together in enterprise rollouts
When it happens
Trigger: `crewai enterprise connect <url>` where the discovery endpoint's JSON omits required keys — e.g. an enterprise deployment that did not configure the device-authorization client, or a discovery document from a different/older product version using different field names.
Common situations: Enterprise server misconfiguration (OAuth provider not fully set up), version mismatch between the CLI's expected schema and the server's discovery document, or a hand-written/mock discovery endpoint missing keys.
Related errors
- Error fetching OAuth2 configuration: {e!s}
- Missing authentication provider required fields in OAuth2 co
- Project name cannot be empty
- Project name '{name}' produces invalid folder name '{folder_
- No deployable project files were found.
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/79f938a044fc3ea2.
Report an issue: GitHub.