gRPC Коды состояния
A high-performance RPC framework by Google. gRPC status codes describe the outcome of remote procedure calls.
Просмотреть спецификацию →О gRPC
gRPC, released by Google in 2015, is a high-performance Remote Procedure Call framework built on HTTP/2 and Protocol Buffers (protobuf) serialization. Unlike REST APIs that return HTTP status codes, gRPC defines its own set of 17 status codes (0 through 16) that map more precisely to RPC failure modes: OK (0), CANCELLED (1), UNKNOWN (2), INVALID_ARGUMENT (3), DEADLINE_EXCEEDED (4), NOT_FOUND (5), and others. These codes travel as the `grpc-status` trailer in HTTP/2 responses. gRPC supports four communication patterns — unary, server streaming, client streaming, and bidirectional streaming — and its status codes apply uniformly across all of them. Understanding gRPC codes is critical for microservice architectures where services communicate via protobuf-defined contracts.
0-16 gRPC Status Codes
Standard gRPC status codes (0-16).
The operation completed successfully. Not an error; returned on success.
The operation was cancelled, typically by the caller.
An unknown error occurred. This may be returned when a server raises an exception that doesn't map to any known …
The client specified an invalid argument. This indicates arguments that are problematic regardless of the state of the system.
The deadline expired before the operation could complete. For operations that change the state of the system, this error may …
Some requested entity was not found. For example, a file or directory that the RPC was supposed to operate on …
The entity that a client attempted to create already exists. For example, a file or directory that the RPC was …
The caller does not have permission to execute the specified operation. This is not for unauthenticated callers — use UNAUTHENTICATED …
Some resource has been exhausted, perhaps a per-user quota, or the entire file system is out of space.
The operation was rejected because the system is not in a state required for the operation's execution. For example, deleting …
The operation was aborted, typically due to a concurrency issue such as a sequencer check failure or transaction abort.
The operation was attempted past the valid range. For example, seeking or reading past the end of a file.
The operation is not implemented or is not supported/enabled in this service.
An internal error occurred. This means that some invariant expected by the underlying system has been broken.
The service is currently unavailable. This is most likely a transient condition, which can be corrected by retrying with a …
Unrecoverable data loss or corruption has occurred.
The request does not have valid authentication credentials for the operation.
Руководства по gRPC
How HTTP trailers work in chunked transfer encoding and HTTP/2, use cases for checksums, server timing, and streaming error reporting.
Choosing the Right HTTP Status Codes for REST APIsPractical guide to selecting appropriate status codes for API responses — from CRUD operations to error handling.
gRPC Status Codes: A Practical GuideHow gRPC status codes map to HTTP codes, when to use each one, and how to handle errors in gRPC …
How to Implement and Handle Rate Limiting (429)Everything about rate limiting — server-side implementation strategies, client-side handling, and the 429 Too Many Requests response.
API Versioning Strategies: URL, Header, and Query ParamHow to version your API without breaking existing clients — comparing URL path, custom header, and query parameter approaches.
Designing Consistent API Error ResponsesHow to build a consistent error response format for your API — status codes, error objects, validation errors, and RFC …