Status Response Codes

The following status codes can be returned in gRPC responses. This is applicable to all versions of gRPC documented on this site.

Code Status Notes
0 OK Return on Success
1 CANCELLED The operation was cancelled, typically by the caller.
2 UNKNOWN For example, this error may be returned when a Status value received from another address space belongs to an error-space that is not known in this address space. Also errors raised by APIs that do not return enough error information may be converted to this error.
3 INVALID_ARGUMENT The client specified an invalid argument.
4 DEADLINE_EXCEEDED The deadline expired before the operation could complete. For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long enough for the deadline to expire.
5 NOT_FOUND Some requested entity was not found.
6 ALREADY_EXISTS The entity that a client attempted to create already exists.
7 PERMISSION_DENIED The caller does not have permission to execute the specified operation. PERMISSION_DENIED must not be used for rejections caused by exhausting some resource (use RESOURCE_EXHAUSTED instead for those errors). PERMISSION_DENIED must not be used if the caller can not be identified (use UNAUTHENTICATED instead for those errors). This error code does not imply the request is valid or the requested entity exists or satisfies other pre-conditions.
8 RESOURCE_EXHAUSTED Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space.
9 FAILED_PRECONDITION The operation was rejected because the system is not in a state required for the operation's execution. For example, the directory to be deleted is non-empty, an rmdir operation is applied to a non-directory, etc.
10 ABORTED The operation was aborted, typically due to a concurrency issue such as a sequencer check failure or transaction abort.
11 OUT_OF_RANGE The operation was attempted past the valid range.
12 UNIMPLEMENTED The operation is not implemented or is not supported/enabled in this service.
13 INTERNAL Internal errors. This means that some invariants expected by the underlying system have been broken. This error code is reserved for serious errors.
14 UNAVAILABLE The service is currently unavailable. This is most likely a transient condition, which can be corrected by retrying with a backoff.
15 DATA_LOSS Unrecoverable data loss or corruption.

Sometimes multiple error codes may apply. Services should return the most specific error code that applies. For example, prefer OUT_OF_RANGE over FAILED_PRECONDITION if both codes apply. Similarly prefer NOT_FOUND or ALREADY_EXISTS over FAILED_PRECONDITION.


A litmus test that may help in deciding between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE:

  • Use UNAVAILABLE if the client can retry just the failing call.
  • Use ABORTED if the client should retry at a higher-level (e.g., when a client-specified test-and-set fails, indicating the client should restart a read-modify-write sequence).
  • Use FAILED_PRECONDITION if the client should not retry until the system state has been explicitly fixed. E.g., if an "rmdir" fails because the directory is non-empty, FAILED_PRECONDITION should be returned since the client should not retry unless the files are deleted from the directory.


A litmus test that may help in deciding between INVALID_ARGUMENT, FAILED_PRECONDITION, and OUT_OF_RANGE:

  • Use INVALID_ARGUMENT if the arguments are problimatic reguardless of the state of the system. (ex. a malformed URL)
  • Use OUT_OF_RANGE if a value is out of range due to the state of the system. (ex. start_date is before start_date_restrict)
  • Use FAILED_PRECONDITION if value is invalid due to the state of the system, but is not an OUT_OF_RANGE value.