BerriAI/litellm · error · GigaChatAuthError
Invalid token response
Error message
Invalid token response: {data} What it means
Error "Invalid token response: {data}" thrown in BerriAI/litellm.
Solutions
- The token endpoint returned an unexpected payload; verify the credentials and auth scope, and check the logged data for the provider's error field.
When it happens
Trigger: Thrown at litellm/llms/gigachat/authenticator.py:229 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Authentication and authorization failures — expired tokens, bad credentials, and missing scopes.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/a5e4b7d38ed38d44.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/gigachat/authenticator.py:229
message=f"GigaChat authentication failed: {e.response.text}",
)
except httpx.RequestError as e:
raise GigaChatAuthError(
status_code=500,
message=f"GigaChat authentication request failed: {e}",
)
def _parse_token_response(response: httpx.Response) -> tuple[str, int]:
"""Parse OAuth token response."""
data: Final = response.json()
# GigaChat returns either 'tok'/'exp' or 'access_token'/'expires_at'
access_token: Final = data.get("tok") or data.get("access_token")
expires_at = data.get("exp") or data.get("expires_at")
if not access_token:
raise GigaChatAuthError(
status_code=500,
message=f"Invalid token response: {data}",
)
# expires_at is in milliseconds
if isinstance(expires_at, str):
expires_at = int(expires_at)
verbose_logger.debug("GigaChat access token obtained successfully")
return access_token, expires_at
View on GitHub (pinned to 77b7c6c40c)