Skip to main content
Watch: I Built an AI App Without Leaving Databricks

Google Gemini API error

Gemini API 504 DEADLINE_EXCEEDED: what it means and how to fix it

Error message
504 DEADLINE_EXCEEDED

Retry? YesLast verified 1 documented fix2 sources

What it means

generateContent API: the service is unable to finish processing within the deadline.

Causes

  • The prompt or context is too large to be processed in time

How to fix it

  1. Fix 1.

    Set a larger timeout in your client request.

More Gemini API errors

All 30 Gemini API errors

HTTP 504 at other providers

FAQ

What does the Gemini API error "504 DEADLINE_EXCEEDED" mean?

generateContent API: the service is unable to finish processing within the deadline.

How do I fix Gemini API "504 DEADLINE_EXCEEDED"?

Set a larger timeout in your client request.

Should I retry Gemini API "504 DEADLINE_EXCEEDED"?

Yes. The official docs treat this error as retryable.

Which other AI APIs return HTTP 504?

Per their official error docs: Anthropic API (504 timeout_error), Mistral API (504 Gateway timeout), OpenRouter (504 timeout), Vertex AI (504 DEADLINE_EXCEEDED).

Sources

Last verified against 2 sources: Gemini API'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.