soma.cell

E0027: unknown_transition_target

E0027 unknown_transition_target — transition() names a state the machine does not declare.

A compile-time error of soma check, the checker of the Soma programming language (soma explain E0027).

The rule

transition(id, "state") must name a state the cell's state machine declares; soma check refuses a target it does not know and suggests the nearest name ("canceled" → "cancelled"). Without the check the typo would only raise at run time. Fix the name, or declare the state and its edge in the state block.

A program that triggers it

wrong.cell

cell Orders {
    state order {
        initial: placed
        placed -> paid
        paid -> shipped
        placed -> cancelled
    }
    on pay(id: String) {
        transition(id, "paid")
    }
    on cancel(id: String) {
        transition(id, "canceled")
    }
}

What soma check prints:

$ soma check wrong.cell
error: transition() to "canceled" (did you mean "cancelled"?) in handler 'cancel' — no such state in `state { }` of cell 'Orders': declare the edge or fix the name
  --> wrong.cell:12:9
   |
12 |         transition(id, "canceled")
   |         ^
  = code: E0027
✗ 1 error(s), 0 warning(s).

The fix field of soma check --json: no such state in `state { }` of cell 'Orders': declare the edge or fix the name

On line 12, transition(id, "canceled") becomes transition(id, "cancelled").

wrong.cell → right.cell

--- wrong.cell
+++ right.cell
@@ -10,5 +10,5 @@
     }
     on cancel(id: String) {
-        transition(id, "canceled")
+        transition(id, "cancelled")
     }
 }

With the fix, soma check accepts the program:

$ soma check right.cell
✓ All checks passed.