Failed precondition
The request is valid, but the data is not in the state the operation needs.
Why it happens
VersionConflict: a command sentifVersion(orIf-Match) and the entity has changed since. The error carries the current entity, and HTTP bindings answer412 Precondition Failed.DependencyFailed: an operation used$refto read an earlier operation's result, and that operation failed.
What to do
- For a version conflict, show the user the current entity from the error's
data, then send the change again with the new version. - For a failed dependency, look at the error of the operation it depended on: that one is the real cause.
What it looks like
Inside a batch, the operation's frame carries it:
json
{
"id": 1,
"error": {
"code": "failed_precondition",
"message": "Review:r1 is at version 4, not 3"
},
"fin": true
}retryable appears only where it differs from the code's default, which is the one at the top of this page.
When the whole request is refused over HTTP, the answer is a problem document:
json
{
"type": "https://eddyboutros.github.io/rayfold/errors/failed_precondition",
"title": "failed precondition",
"status": 400,
"detail": "Review:r1 is at version 4, not 3",
"code": "failed_precondition"
}See also all error types and the errors chapter of the specification.