gRPC status 9: FAILED_PRECONDITION

FAILED_PRECONDITION is gRPC status code 9. The system is not in the state the call needs, such as deleting a directory that is not empty.

Updated

Usual causes

  • The entity is in the wrong state: an order already shipped, an account frozen.
  • An optimistic concurrency check failed at the application level, and the server chose this code over ABORTED.

What to check

  1. The current state of the entity the call acts on.
  2. A PreconditionFailure detail in the trailers, which names the violation.

Not to be confused with

Use UNAVAILABLE for a transient condition the client can wait out, ABORTED for a conflict to retry at a higher level, and FAILED_PRECONDITION for one the client must fix.

What it looks like

A typical error, as a Go client prints it: rpc error: code = FailedPrecondition desc = directory not empty

Retry, and the HTTP equivalent

FAILED_PRECONDITION
Code9
NameFAILED_PRECONDITION
In istek's status barfailed_precondition
RetryNot until the state has changed; retrying the same call immediately will fail again.
HTTP status400

istek names the status of every call it makes, failed_precondition included, and explains transport failures in plain words. See istek.

istek, $29 once

macOS 14.0+ · Apple Silicon · no account, no telemetry

Buy istek · $29