state_conflict: The action does not fit the current state

The resource exists, but its state does not allow this action, for example opening a child under a frozen parent, or deciding an approval that is already decided.

What to do

On the wire

HTTP 409, error type state_error.

With Dynamo-Error-Detail: 1, and on the routes added in owner-api 1.4.0 and later (for example the approvals routes) with or without it:

{
  "error": "state",
  "detail": "…",
  "errorDetail": {
    "type": "state_error",
    "code": "state_conflict",
    "message": "…",
    "param": null,
    "doc_url": "…/errors/state_conflict.md",
    "fix": "the resource is not in a state that allows this action"
  }
}

On the older routes without the header the body is {"error": "state", "detail": "…"}, with no reason and no errorDetail.

See all error codes.