gRPC

gRPC 3 INVALID_ARGUMENT vs 14 UNAVAILABLE

Both gRPC 3 (INVALID_ARGUMENT) and 14 (UNAVAILABLE) belong to the gRPC Status Codes category. 3 indicates that the client specified an invalid argument. This indicates arguments that are problematic regardless of the state of the system. Meanwhile, 14 means that the service is currently unavailable. This is most likely a transient condition, which can be corrected by retrying with a backoff.

説明

The client specified an invalid argument. This indicates arguments that are problematic regardless of the state of the system.

このコードが表示される場合

A request field failed validation — for example, a negative page size, a malformed email, or a required field left empty.

解決方法

Inspect the request payload and fix the invalid field. Check the API documentation for expected formats and constraints.

説明

The service is currently unavailable. This is most likely a transient condition, which can be corrected by retrying with a backoff.

このコードが表示される場合

The server is overloaded, shutting down, or a network partition occurred. This is the most common code to retry on, as it's explicitly transient.

解決方法

Retry with exponential backoff. If persistent, check the server health, load balancer configuration, and network connectivity between client and server.

主な違い

1.

gRPC 3: The client specified an invalid argument. This indicates arguments that are problematic regardless of the state of the system.

2.

gRPC 14: The service is currently unavailable. This is most likely a transient condition, which can be corrected by retrying with a backoff.

3.

You encounter 3 when a request field failed validation — for example, a negative page size, a malformed email, or a required field left empty.

4.

You encounter 14 when the server is overloaded, shutting down, or a network partition occurred. This is the most common code to retry on, as it's explicitly transient.

どちらをいつ使うか

For 3 (INVALID_ARGUMENT): Inspect the request payload and fix the invalid field. Check the API documentation for expected formats and constraints. For 14 (UNAVAILABLE): Retry with exponential backoff. If persistent, check the server health, load balancer configuration, and network connectivity between client and server.

詳しく見る