In light of COVID-19, please review the latest announcement regarding the Reserve with Google guidelines for supporting users and merchants during this time. Additionally, since we are operating with a limited support team, it may take longer to connect with us. Thank you for your patience, and we value your partnership.

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 isn't known in this address space. Also errors raised by APIs that don't 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 was complete. For operations that change the state of the system, this error may be returned even if the operation is completed successfully. For example, a successful response from a server which was delayed long enough for the deadline to expire.
5 NOT_FOUND Some requested entity wasn't found.
6 ALREADY_EXISTS The entity that a client attempted to create already exists.
7 PERMISSION_DENIED The caller doesn't have permission to execute the specified operation. Don't use PERMISSION_DENIED for rejections caused by exhausting some resource; use RESOURCE_EXHAUSTED instead for those errors. Don't use PERMISSION_DENIED if the caller can't be identified (use UNAUTHENTICATED instead for those errors). To receive a PERMISSION_DENIED error code doesn't 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 or an rmdir operation is applied to a non-directory.
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 isn't implemented or isn't 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 that can be corrected if retried with a backoff.
15 DATA_LOSS Unrecoverable data loss or corruption.
16 UNAUTHENTICATED The request doesn't have valid authentication credentials for the operation.

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.

FAILED_PRECONDITION vs. ABORTED vs. UNAVAILABLE

The following is a litmus test that may help you decide 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, such as when a client-specified test-and-set fails which indicates that 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. For example, if an "rmdir" fails because the directory is non-empty, it is best to return FAILED_PRECONDITION because the client should not retry unless the files are deleted from the directory.

INVALID_ARGUMENT vs. FAILED_PRECONDITION vs. OUT_OF_RANGE

The following is a litmus test that may help you decide between INVALID_ARGUMENT, FAILED_PRECONDITION, and OUT_OF_RANGE:

  • Use INVALID_ARGUMENT if the arguments are problematic regardless of the state of the system. For example: a malformed URL
  • Use OUT_OF_RANGE if a value is out of range due to the state of the system. For example, the start_date is before start_date_restrict.
  • Use FAILED_PRECONDITION if the value is invalid due to the state of the system, but isn't an OUT_OF_RANGE value.