> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cortex.foundation/llms.txt
> Use this file to discover all available pages before exploring further.

# invalid_state

> Not allowed in the current state. HTTP 422.

|           |                                                         |
| --------- | ------------------------------------------------------- |
| HTTP      | `422`                                                   |
| `code`    | `invalid_state`                                         |
| `type`    | `https://docs.cortex.foundation/problems/invalid_state` |
| Retryable | no                                                      |

The request is well-formed but the resource forbids it — for example cancelling a Code turn that already finished, or restoring a runtime that is shutting down.

```json theme={null}
{
  "type": "https://docs.cortex.foundation/problems/invalid_state",
  "title": "Not allowed in the current state",
  "status": 422,
  "code": "invalid_state",
  "request_id": "req_…"
}
```

## Related

* [Errors](/reference/errors) - how to branch on `code`, and what not to render from `detail`.
* [Problem catalog](/problems) - every code, its status, and whether retrying helps.
* [Troubleshooting](/getting-started/troubleshooting) - what a message in the product means.
