Generative AI on Vertex AI inference API errors

This guide provides a list of errors that you might encounter from using the Model API reference for Generative AI. The errors follow the error model of the Google Cloud API, which recommends that we provide guidance on the causes and the solutions specific to the generative AI models.

API errors

This table provides API error codes and descriptions.

HTTP error codeCanonical error codeCauseExampleSolution
400INVALID_ARGUMENT / FAILED_PRECONDITIONRequest fails API validation, or you tried to access a model that requires allowlisting or is disallowed by the organization's policy.Request exceeds the model's input token limit.Refer to the Model API reference for Generative AI for request parameters, token count, and other parameters.
403PERMISSION_DENIEDClient doesn't have sufficient permission to call the API.Service account doesn't have permission to access the Cloud Storage bucket hosting image or video resources.1. Verify that all necessary APIs are enabled, and the service account has the right permission to access the selected Vertex AI service.

2. Vertex AI per-product, per-project service account (P4SA) is granted the necessary permission to access resources referenced in the input.
404NOT_FOUNDNo valid object is found from the designated URL.Image file not found in the storage URL.Check and fix the file location.
429RESOURCE_EXHAUSTEDDepending on the error message, the error could be caused by the following:

1. API quota over the limit.

2. Server overload due to shared server capacity.

3. You've reached the daily limit for requests using logprobs.
Gemini API exceeds request per minute limit.1. Check Vertex AI Generative AI quota limits. If needed, apply for a higher quota.

2. Retry after a few seconds. If the error persists after a prolonged period of time (hours), contact Vertex AI support.
499CANCELLEDRequest is cancelled by the client.
500UNKNOWN / INTERNALServer error due to overload or dependency failure.Request is throttled, because the service is temporarily overloaded.Retry after a few seconds. If the error persists after a prolonged period of time (hours), contact Vertex AI support.
503UNAVAILABLEService is temporarily unavailable.Server isn't responding to the incoming requests.The unavailable status might be temporary. However, if the error persists, contact Vertex AI support.
504DEADLINE_EXCEEDEDThe client sets a deadline shorter than the server's default deadline (10 minutes), and the request didn't finish within the client-provided deadline.Consider increasing the client-provided deadline.

Handle errors

Avoid spikes in traffic. Spikes are sudden and significant increases in the number of requests within a very short period of time. Sometimes, spikes in traffic might cause issues for quota enforcement and might increase the chance of server overloading.

Be careful about retrying an event. We recommend retrying no more than two times. The minimum delay is one second with subsequent requests backing up exponentially.

What's next