Linear state not found
1 min read
Moving an issue looks up the target workflow state by name across the team's states and throws when nothing matches.
const targetState = states.find(
(s) => s.name.toLowerCase() === stateName.toLowerCase()
);
if (!targetState) throw new Error(`State "${stateName}" not found`);
Why matching by name is fragile
Linear workflow states are per-team and freely renameable. "In Progress" becomes "In Dev", "Done" becomes "Shipped", and every integration referring to the old name breaks — silently, from the perspective of whoever renamed it, because nothing in Linear warns that an API consumer depended on it.
Matching by id would be stable and much harder to configure, since ids are opaque and differ per team. Case-insensitive name matching is the pragmatic middle, and this error is the cost of that choice.
What causes it
A renamed state, most often.
A different team. States are per-team, so a name that exists on one team may not exist on another. An issue routed to an unexpected team produces this.
Casing or whitespace. Casing is handled; a trailing space is not.
How to fix it
List the team's actual states and compare against what is configured. The mismatch is usually obvious once both are visible.
If this recurs, the durable fix is to resolve state names to ids once at connection time and store the ids, accepting that a rename then requires a reconnect rather than breaking at dispatch time.
Case handled, whitespace not
The comparison lowercases both sides, so casing differences are absorbed. A trailing space in a configured value is not, and it is invisible in most UIs — worth checking before assuming the state was renamed.
