precondition_failed error (HTTP 412)
HTTP status: 412 Precondition Failed
You sent an If-Match header, and the resource no longer has that ETag. It changed after you read it, so your write was refused and nothing from your request was saved. On a GET, the resource isn’t returned.
You only get this error when you send If-Match. A PUT without the header (or with If-Match: *) applies unconditionally, and a write that loses a race at the same moment gets conflict instead.
Common causes
Section titled “Common causes”- Another user, token or the dashboard updated the resource between your
GETand yourPUT. - Another endpoint changed something in the resource’s body. The ETag covers all of it, so toggling a flag, archiving it, or setting its owner, expiry, permanence or removal PR changes the flag’s ETag, and a toggle also changes its environment config and targeting ETags.
- On a targeting
PUT, a rule in that environment was added, deleted, edited or reordered. The targeting ETag covers the whole rule set. - On a webhook, a delivery failed. The failure count is part of the body, so each failed delivery changes the ETag. Retrying right after a fresh
GETalmost always works. - Your token’s role changed. The ETag covers
_actions, which depends on the role. - The resource has no ETag: a list, or an environment in which the flag has never been configured.
- The header doesn’t hold an ETag this resource issues: a weak tag (
W/"80857c9ec8c53314"), an unquoted value, or a list of several tags.
How to fix
Section titled “How to fix”GETthe resource again and read itsETagresponse header.- Check whether your change still makes sense against what’s there now, and re-apply it to the fresh copy.
- Send the
PUTagain with the new ETag, for exampleIf-Match: "80857c9ec8c53314".
See Conditional writes for which endpoints support If-Match.
Example
Section titled “Example”{ "error": "precondition_failed", "message": "The resource changed since the ETag you sent. GET it again, then retry with the new ETag.", "docs_url": "https://featureflip.io/docs/management-api/errors/precondition_failed"}