gRPC status 4: DEADLINE_EXCEEDED

DEADLINE_EXCEEDED is gRPC status code 4. The deadline expired before the call finished. The server took longer than the time the client allowed.

Updated

Usual causes

  • The server was slow: a slow query, a lock, or a downstream call that took most of the budget.
  • The deadline is too short for the work, often a default copied from a faster endpoint.
  • The connection could not be established in time, so the call never reached the server.
  • Deadline propagation: the call inherited a nearly spent deadline from an upstream request.

What to check

  1. The deadline you set against the server's own latency for this method.
  2. Whether the server received the call at all; if it has no log line, the time went on connecting.
  3. Downstream calls the handler makes, since each one spends the same budget.
  4. Server-side, whether the operation completed anyway; a timed-out write may still have been applied.

Not to be confused with

UNAVAILABLE means the server could not be reached; DEADLINE_EXCEEDED means time ran out, whether connecting or waiting.

What it looks like

A typical error, as a Go client prints it: rpc error: code = DeadlineExceeded desc = context deadline exceeded

Retry, and the HTTP equivalent

DEADLINE_EXCEEDED
Code4
NameDEADLINE_EXCEEDED
In istek's status bardeadline_exceeded
RetryOnly if the operation is idempotent, because it may have completed on the server.
HTTP status504

istek names the status of every call it makes, deadline_exceeded included, and explains transport failures in plain words. See istek.

istek, $29 once

macOS 14.0+ · Apple Silicon · no account, no telemetry

Buy istek · $29