Google Gemini API
Gemini API errors and fixes
30 Gemini API errors from the official error docs, grouped by HTTP status, each with what it means, why it happens, the documented fix and whether to retry. Verified .
- Official error docsai.google.dev
- Status pageaistudio.google.com
- Gemini API rate limits
Error response body
The shape Gemini API errors come back in, as the official docs show it. Read the status and error type from here before matching an entry below.
Interactions API (recommended): {"error": {"code": "invalid_request", "message": "The value 'invalid_tool_type_xyz' is not supported for 'type' at 'tools[0]'."}}. Streaming (SSE): {"event_type": "error", "error": {"code": "not_found", "message": "Failed to get completed interaction: Result not found."}}. generateContent API (legacy): {"error": {"code": 400, "message": "API key not valid. Please pass a valid API key.", "status": "INVALID_ARGUMENT", "details": [{"@type": "type.googleapis.com/google.rpc.ErrorInfo", "reason": "API_KEY_INVALID", "domain": "googleapis.com", "metadata": {"service": "generativelanguage.googleapis.com"}}, {"@type": "type.googleapis.com/google.rpc.LocalizedMessage", "locale": "en-US", "message": "API key not valid. Please pass a valid API key."}]}}
HTTP 400 Bad Request
400 invalid_requestInteractions API code for a request payload that is malformed or contains invalid parameters.Retry? No400 failed_preconditionThe request cannot be processed because a prerequisite is not met, for example disabled billing.Retry? No400 parameter_unknownThe request contains a parameter the API does not recognize.Retry? No400 INVALID_ARGUMENTgenerateContent API: the request body is malformed. The same status is returned with reason API_KEY_INVALID when the API key is not valid.Retry? No400 FAILED_PRECONDITIONgenerateContent API: Gemini API free tier is not available in your country, and billing is not enabled on the project in Google AI Studio.Retry? No
HTTP 401 Unauthorized
HTTP 402 Payment Required
HTTP 403 Forbidden
HTTP 404 Not Found
HTTP 409 Conflict
HTTP 416 Range Not Satisfiable
HTTP 429 Too Many Requests
429 rate_limit_exceededYou have exceeded the per-minute or per-second request or token limit. Limits are applied per project, not per API key.Retry? Yes429 quota_exceededYou have exceeded your daily quota. Requests per day (RPD) quotas reset at midnight Pacific time.Retry? Yes429 too_many_requestsYou have made too many requests in a short period of time.Retry? Yes429 RESOURCE_EXHAUSTEDgenerateContent API: you have exceeded one of the API rate limits (RPM, TPM, RPD, spend, and so on). Spend-based limits are evaluated over a rolling 10-minute window per usage tier and also return this error.Retry? Yes
HTTP 499
HTTP 500 Internal Server Error
HTTP 501 Not Implemented
HTTP 503 Service Unavailable
HTTP 504 Gateway Timeout
No HTTP status
Newsletter
Know when the APIs change
One email per week. New model releases, API changes, what broke, and how developers are working around it.