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.

Description

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

Quand vous le voyez

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.

Comment résoudre

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

Description

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.

Quand vous le voyez

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.

Comment résoudre

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.

Différences clés

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.

Quand utiliser lequel

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.

En savoir plus