BerriAI/litellm · error · ValueError

Databricks App OAuth token response missing 'access_token'

Error message

Databricks App OAuth token response missing 'access_token'

What it means

Raised in the Databricks App OAuth flow as the final shape check: the response was 2xx, parsed as JSON, and is a dict, but it has no 'access_token' key — mandatory for a client-credentials grant. Typically means the credentials are valid HTTP-wise but the app lacks the right scopes, or the endpoint is not a real OAuth token endpoint.

Source

Thrown at litellm/proxy/agent_endpoints/databricks_oauth.py:202

                    "Content-Type": "application/x-www-form-urlencoded",
                },
            )
        except httpx.HTTPStatusError as exc:
            raise ValueError(
                f"Databricks App OAuth token request failed with status {exc.response.status_code}"
            ) from exc
        except httpx.HTTPError as exc:
            raise ValueError(f"Databricks App OAuth token request failed: {exc}") from exc

        body: Final = response.json()
        if not isinstance(body, dict):
            raise ValueError(
                f"Databricks App OAuth token response returned non-object JSON (got {type(body).__name__})"
            )

        access_token: Final = body.get("access_token")
        if not access_token:
            raise ValueError("Databricks App OAuth token response missing 'access_token'")

        raw_expires_in: Final = body.get("expires_in")
        try:
            expires_in = int(raw_expires_in) if raw_expires_in is not None else _DEFAULT_TTL_SECONDS
        except (TypeError, ValueError):
            expires_in = _DEFAULT_TTL_SECONDS

        ttl: Final = max(expires_in - _TOKEN_EXPIRY_BUFFER_SECONDS, 0)
        return access_token, ttl


databricks_app_oauth_token_cache: Final = DatabricksAppOAuthTokenCache()


async def resolve_databricks_app_auth_header(
    litellm_params: dict[str, Any] | None,
) -> dict[str, str] | None:
    """Return ``{"Authorization": "Bearer <token>"}`` for a Databricks App agent.

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Verify the token response contains access_token; check credentials and grant.

Example fix

Log the token response and confirm 'access_token'.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/agent_endpoints/databricks_oauth.py:202 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/1350988c695456d0. Report an issue: GitHub.