BerriAI/litellm · error · ValueError

Databricks App OAuth token request failed: {exc}

Error message

Databricks App OAuth token request failed: {exc}

What it means

Raised in the Databricks App OAuth client-credentials flow when the token request fails with an httpx error other than HTTPStatusError — i.e. a transport-level failure: connection refused, DNS failure, TLS error, or timeout hitting config.token_url. The original exception is chained. HTTP-error responses have their own separate wrapper with the status code.

Source

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

        basic_auth: Final = base64.b64encode(f"{config.client_id}:{config.client_secret}".encode()).decode()
        try:
            response: Final = await client.post(
                config.token_url,
                data={
                    "grant_type": "client_credentials",
                    "scope": config.scope,
                },
                headers={
                    "Authorization": f"Basic {basic_auth}",
                    "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)

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Check network connectivity to the Databricks token endpoint; see exception detail.

Example fix

Check proxy logs for the underlying exception.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/proxy/agent_endpoints/databricks_oauth.py:192 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/e890eb8b3f6c6c67. Report an issue: GitHub.