Google Vertex AI (generative AI) error
Vertex AI 401 UNAUTHENTICATED: what it means and how to fix it
401 UNAUTHENTICATEDRetry? NoLast verified 1 documented fix2 sources
What it means
The request is not authenticated because the OAuth token is missing, invalid, or expired.
Causes
- Missing OAuth token
- Invalid or expired OAuth token
How to fix it
- Fix 1.
Verify that the Authorization header contains a valid access token. With the Google Cloud CLI, generate one with:
Snippetgcloud auth print-access-token
More Vertex AI errors
All 11 Vertex AI errors400 INVALID_ARGUMENT / FAILED_PRECONDITIONRetry? No403 PERMISSION_DENIEDRetry? No404 NOT_FOUNDRetry? No429 RESOURCE_EXHAUSTEDRetry? Yes429 Resource exhausted, please try again laterRetry? Yes429 Too many requests. Exceeded the Provisioned ThroughputRetry? Not stated499 CANCELLEDRetry? Not stated500 UNKNOWN / INTERNALRetry? Yes
HTTP 401 at other providers
Compare 401 across providers401 authentication_errorRetry? Not statedAnthropic API401 UnauthorizedRetry? Not statedAzure OpenAI401 UnauthorizedRetry? Not statedCohere API401 - Authentication FailsRetry? Not statedDeepSeek API401 authenticationRetry? NoGemini API401 UnauthorizedRetry? Not statedGroq API401 UnauthorizedRetry? Not statedMistral API401 Invalid AuthenticationRetry? Not statedOpenAI API401 Incorrect API key providedRetry? Not statedOpenAI API401 You must be a member of an organization to use the APIRetry? Not statedOpenAI API401 IP not authorizedRetry? Not statedOpenAI API401 authenticationRetry? Not statedOpenRouter
FAQ
What does the Vertex AI error "401 UNAUTHENTICATED" mean?
The request is not authenticated because the OAuth token is missing, invalid, or expired.
How do I fix Vertex AI "401 UNAUTHENTICATED"?
Verify that the Authorization header contains a valid access token. With the Google Cloud CLI, generate one with:
Should I retry Vertex AI "401 UNAUTHENTICATED"?
No. The official docs treat this error as not retryable: fix the cause before sending the request again.
Which other AI APIs return HTTP 401?
Per their official error docs: Anthropic API (401 authentication_error), Azure OpenAI (401 Unauthorized), Cohere API (401 Unauthorized), DeepSeek API (401 - Authentication Fails), Gemini API (401 authentication), Groq API (401 Unauthorized), Mistral API (401 Unauthorized), OpenAI API (401 Invalid Authentication; 401 Incorrect API key provided; 401 You must be a member of an organization to use the API; 401 IP not authorized), OpenRouter (401 authentication), xAI API (401 Unauthorized).
Sources
Last verified against 2 sources: Vertex AI's official docs and official SDK repositories.
Newsletter
Know when the APIs change
One email per week. New model releases, API changes, what broke, and how developers are working around it.