recourse_state: The case cannot do this now

An answer needs an open case; resolve and escalate need an open or answered case. A resolved or escalated case is final. Nothing changed.

The same code answers two other requests: asking for the arbitrator package (GET /owner/v1/recourse/cases/{id}/package) of a case that was not escalated, and an action that raced another change to the same case (retry it).

What to do

On the wire

HTTP 409, error type state_error. Without Dynamo-Error-Detail: 1 every client receives {"error": "state", "reason": "recourse_state", "detail": "…"} with no errorDetail: the owner and payee recourse routes add it only when the request sends that header, on a single-tenant core and on the hosted tier alike.

With Dynamo-Error-Detail: 1:

{
  "error": "state",
  "reason": "recourse_state",
  "detail": "…",
  "errorDetail": {
    "type": "state_error",
    "code": "recourse_state",
    "message": "…",
    "param": "case",
    "doc_url": "…/errors/recourse_state.md",
    "fix": "the case is not in a state that allows this (an answer needs an open case; resolve and escalate need an open or answered one)"
  }
}

The arbitrator package route answers a case that was not escalated with {"error": "state", "reason": "recourse_state", "detail": "…"} and never adds errorDetail, even with the header.

See recourse and all error codes.