BerriAI/litellm · error · ValueError
Could not resolve credentials
Error message
Could not resolve credentials
What it means
Generic sentinel when the async load-and-cache credential path fails: load_auth threw (via asyncify) and no more specific error applies, so no (credentials, project_id) tuple can be produced or cached for the request.
Source
Thrown at litellm/llms/vertex_ai/vertex_llm_base.py:488
return _TokenState.INVALID
async def _load_and_cache_credentials(
self,
credentials: VERTEX_CREDENTIALS_TYPES | None,
project_id: str | None,
credential_cache_key: tuple,
) -> tuple[Any, str | None]:
"""Load credentials via load_auth (in thread) and cache the result."""
try:
_credentials, credential_project_id = await asyncify(self.load_auth)(
credentials=credentials,
project_id=project_id,
)
except Exception as e:
verbose_logger.exception("Failed to load vertex credentials: %s", str(e))
raise
if _credentials is None:
raise ValueError("Could not resolve credentials")
self._credentials_project_mapping[credential_cache_key] = (
_credentials,
credential_project_id,
)
return _credentials, credential_project_id
async def _background_refresh_credentials(
self,
credentials: Any,
credential_cache_key: tuple,
credential_project_id: str | None,
) -> None:
"""
Refresh credentials in the background without blocking the calling request.
Called when the token is still valid but nearing expiry (proactive refresh).
Errors are logged but not raised — the current token is still usable.
"""View on GitHub (pinned to 77b7c6c40c)
Solutions
- Provide credentials via vertex_credentials, the GOOGLE_APPLICATION_CREDENTIALS env var, or a service account JSON env var.
- Verify the credential source is valid and accessible (file exists, JSON parses) in the runtime environment.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at litellm/llms/vertex_ai/vertex_llm_base.py:488 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/a9ae118e3c0ed2e8.
Report an issue: GitHub.