# X_STATE_TRANSITION_ILLEGAL

## Means

the machine has no such transition

## Typical cause

three conditions and one code, because they share one repair — the move is not in the table — and `cause` states which. `"<from>"` is not a state the `enumerated()` set declares; the row is terminal in `"<from>"`, an empty move list being how a terminal state is written; or the move to `"<to>"` was never declared. The unknown-state branch is separate because an unknown state has no outgoing moves either, so a single "no legal moves" answer reported a typo as "the row is terminal in `<typo>`" — a sentence about a state that does not exist. **422 and not 400**: the request is well formed and its schema passed, which is `X_INVARIANT_VIOLATED`'s shape and takes its status. Refused before any statement opens a connection, so nothing was written

## Fix

the `fix` is the same call with a legal target substituted — `orders.transition('status', id, { from: 'pending', to: 'paid' })` — or add `"<to>"` to the `"<from>"` entry of the `transitions()` table

[Entity and database](/error-codes#entity-and-database)
