gRPC status codes explained
Every gRPC call completes with a status consisting of a numeric code and an optional message. Unlike HTTP, gRPC defines a fixed, language-neutral set of 17 codes (0–16) that every implementation shares. This reference lists all of them with their numeric value, the conventional HTTP status they map to in gateways, a plain-language meaning, and whether the call is generally safe to retry.
How it works
gRPC status codes are defined in the grpc-status trailer of every response. Code 0 (OK) means success; any non-zero code is an error. The codes split roughly into three groups:
- Client errors the caller should fix:
INVALID_ARGUMENT(3),NOT_FOUND(5),PERMISSION_DENIED(7),FAILED_PRECONDITION(9),UNAUTHENTICATED(16). - Transient errors worth retrying:
DEADLINE_EXCEEDED(4),RESOURCE_EXHAUSTED(8),ABORTED(10),UNAVAILABLE(14). - Server faults that signal bugs:
UNKNOWN(2),INTERNAL(13),DATA_LOSS(15).
When a gRPC service is exposed over HTTP via a gateway, codes map to HTTP statuses by convention — NOT_FOUND becomes 404, UNAVAILABLE becomes 503, and so on. That mapping is shown per row so you can reason about both protocols at once.
Retry guidance and example
A safe retry policy retries only idempotent calls that failed with UNAVAILABLE, and uses exponential backoff:
attempt 1 -> wait 100ms
attempt 2 -> wait 200ms
attempt 3 -> wait 400ms (then give up)
Avoid retrying INVALID_ARGUMENT, NOT_FOUND or PERMISSION_DENIED — the inputs must change first. For RESOURCE_EXHAUSTED, honour any retry-delay the server returns rather than hammering it. Use the table below to confirm a code’s number and HTTP equivalent before wiring up interceptors.