gRPC

gRPC 9 FAILED_PRECONDITION vs 13 INTERNAL

Both gRPC 9 (FAILED_PRECONDITION) and 13 (INTERNAL) belong to the gRPC Status Codes category. 9 indicates 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. Meanwhile, 13 means that an internal error occurred. This means that some invariant expected by the underlying system has been broken.

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.

Descripción

An internal error occurred. This means that some invariant expected by the underlying system has been broken.

Cuándo lo verás

A server-side bug, a corrupted internal state, or an unexpected failure in a dependency. This is the gRPC equivalent of HTTP 500.

Cómo solucionarlo

Check the server error logs and traces for the root cause. This typically indicates a bug that needs to be fixed in the server code.

Diferencias clave

1.

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.

2.

gRPC 13: An internal error occurred. This means that some invariant expected by the underlying system has been broken.

3.

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.

4.

You encounter 13 when a server-side bug, a corrupted internal state, or an unexpected failure in a dependency. This is the gRPC equivalent of HTTP 500.

Cuándo usar cada uno

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. For 13 (INTERNAL): Check the server error logs and traces for the root cause. This typically indicates a bug that needs to be fixed in the server code.

Saber más