gemini
Gemini API Error Codes
Error codes returned by the Google Gemini API. Errors follow Google's standard API error model: an HTTP status paired with a gRPC-style status name.
16 codes
· All codes 16 codes
- ABORTED Aborted The operation was aborted, typically due to a concurrency conflict such as two requests modifying the same tuned model or cached content at the same time. Maps to HTTP 409; retry the higher-level operation.
- ALREADY_EXISTS Already Exists The resource being created already exists, such as tuning a model under a display name that's already in use. Maps to HTTP 409; choose a different identifier or reuse the existing resource.
- CANCELLED Cancelled The request was cancelled, typically because the client closed the connection or aborted a streaming request before it completed. Maps to HTTP 499; no server-side action is needed.
- DATA_LOSS Data Loss Unrecoverable data loss or corruption occurred while processing the request, an infrastructure-level failure rather than something the caller can fix. Maps to HTTP 500; retry, and report persistent occurrences.
- DEADLINE_EXCEEDED Deadline Exceeded The request took longer than the configured client deadline to complete, often due to a large input or output payload. Maps to HTTP 504; increase the client-side timeout.
- FAILED_PRECONDITION Failed Precondition The request can't be completed in the project's current state, commonly because the free tier isn't available in the caller's region or because billing hasn't been enabled. Maps to HTTP 400.
- INTERNAL Internal An unexpected error occurred on Google's servers, sometimes triggered by an excessively long input context. Maps to HTTP 500; retry the request, optionally with a shorter input.
- INVALID_ARGUMENT Invalid Argument The request body is malformed or contains a parameter the API cannot process, such as invalid JSON or a field of the wrong type. Maps to HTTP 400; check the request against the Gemini API reference.
- NOT_FOUND Not Found The requested resource doesn't exist, typically caused by an incorrect or deprecated model name in the request path. Maps to HTTP 404.
- OUT_OF_RANGE Out of Range The request specifies a value outside the valid range for the target resource, such as a byte offset or index beyond the bounds of a file or context. Maps to HTTP 400.
- PERMISSION_DENIED Permission Denied The API key is missing, invalid, or lacks access to the requested model or endpoint. Maps to HTTP 403; verify the key and its access scope in AI Studio or Google Cloud Console.
- RESOURCE_EXHAUSTED Resource Exhausted The project has exceeded a rate limit or quota, measured across requests per minute, input tokens per minute, and requests per day. Maps to HTTP 429; retry with exponential backoff and check current limits in AI Studio.
- UNAUTHENTICATED Unauthenticated The request lacks valid authentication credentials, such as a missing API key or an invalid OAuth token. Maps to HTTP 401; distinct from PERMISSION_DENIED, which means the caller authenticated successfully but isn't authorized for the request.
- UNAVAILABLE Unavailable The service is temporarily overloaded or down, a capacity issue on Google's side rather than the caller's. Maps to HTTP 503; retry with exponential backoff.
- UNIMPLEMENTED Unimplemented The requested method or feature isn't implemented or isn't supported for the specified model, such as calling an operation that a given model or API version doesn't expose. Maps to HTTP 501.
- UNKNOWN Unknown An unknown error occurred; the server returned an error without enough information to determine a more specific status, or a client library propagated an unexpected error type. Maps to HTTP 500.