gRPC

gRPC 8 RESOURCE_EXHAUSTED vs 9 FAILED_PRECONDITION

Both gRPC 8 (RESOURCE_EXHAUSTED) and 9 (FAILED_PRECONDITION) belong to the gRPC Status Codes category. 8 indicates that some resource has been exhausted, perhaps a per-user quota, or the entire file system is out of space. Meanwhile, 9 means that the operation was rejected because the system is not in a state required for the operation's execution. For example, deleting a non-empty directory.

Descripción

Some resource has been exhausted, perhaps a per-user quota, or the entire file system is out of space.

Cuándo lo verás

A rate limit was hit, a quota was exceeded, or the server ran out of memory/disk. Common with API rate limiting and resource quotas.

Cómo solucionarlo

Implement exponential backoff and retry. If quota-related, request a quota increase or optimize your usage pattern to stay within limits.

Descripción

The operation was rejected because the system is not in a state required for the operation's execution. For example, deleting a non-empty directory.

Cuándo lo verás

The request is valid on its own, but the system's current state doesn't allow it — like trying to delete a non-empty directory or update a resource that has been modified concurrently.

Cómo solucionarlo

Bring the system into the required state before retrying. For example, empty the directory first, or re-read the resource to get the latest version before updating.

Diferencias clave

1.

gRPC 8: Some resource has been exhausted, perhaps a per-user quota, or the entire file system is out of space.

2.

gRPC 9: The operation was rejected because the system is not in a state required for the operation's execution. For example, deleting a non-empty directory.

3.

You encounter 8 when a rate limit was hit, a quota was exceeded, or the server ran out of memory/disk. Common with API rate limiting and resource quotas.

4.

You encounter 9 when the request is valid on its own, but the system's current state doesn't allow it — like trying to delete a non-empty directory or update a resource that has been modified concurrently.

Cuándo usar cada uno

For 8 (RESOURCE_EXHAUSTED): Implement exponential backoff and retry. If quota-related, request a quota increase or optimize your usage pattern to stay within limits. For 9 (FAILED_PRECONDITION): Bring the system into the required state before retrying. For example, empty the directory first, or re-read the resource to get the latest version before updating.

Saber más