> ## Documentation Index
> Fetch the complete documentation index at: https://cortex-foundation-add13747-droid-1a2462c9-cor-444-sanitize.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# invalid_state

> Not allowed in the current state. HTTP 422.

# `invalid_state`

|           |                                                         |
| --------- | ------------------------------------------------------- |
| 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 `stopping`.

```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_…"
}
```

See [Errors](/api/errors) for how to branch, and what not to render from `detail`.
