union_no_branch_matched
No alternative in a (union-shape …) accepted the value.
Alternatives are tried in declaration order and the first full match wins; this fires when none does. The message names every alternative rather than forwarding one branch’s private cause, because a hand-written union’s alternatives may overlap on purpose and there is no arm to blame, so rewrite the value to fit one of the shapes listed.
A (scalar-or-ref-shape …) slot is the one exception. Its two
arms are disjoint by node shape (a number can only have meant
the base, a symbol only the ref) so a value that fits neither
reports the arm its shape selected, with that arm’s own code:
number_above_max naming the bound, not_cross_ref naming the
form the symbol had to be declared by. On such a slot this code
therefore means the value was a shape neither arm reaches (a
string or a vector in a number | symbol slot), or, when the
base is itself a symbol kind, a symbol both arms reach.
Run sjon explain union_no_branch_matched to read this at a terminal, browse every code, or work through diagnostics-driven repair if you want the habit rather than the answer.