The alert classifier in my shared n8n error handler matched its regexes over the full error text. That text includes the queue item's title. So when a note whose title contained the word "JSON" hit a normal 48-hour approval expiry, the classifier found its data-contract pattern first and filed a false alarm.
What Actually Happened
Execution 16440 ran on 17 October. It was a routine approval wait that expired after 48 hours, which is expected behaviour. Nothing was broken.
The note being processed had "JSON" in its title. The error string n8n surfaces for an expired wait embeds the item title, so the full text the classifier saw looked something like a response containing JSON that had failed validation.
The data-contract regex matched. The alert went out saying a response had failed its data contract. It had not.
Where the Classifier Lives
The handler source is badboylabs-web/n8n/code/machine-alerts-compose.js. It is shared across workflows, so a bug here affects every alert that routes through it.
The fix was committed on 23 October 2026 (commit 21ddd20, message: fix(n8n): label an expired approval wait as expected, not a data contract failure) and published to workflow xLSMPrPD0mRIlzZa as version ed279679 with staticData preserved.
Why the Order Matters
The classifier works through a list of patterns and returns the first match. Before the fix, the order was roughly:
- Data-contract failure pattern checked first, broad, matches any error text containing certain JSON-adjacent words.
- Approval expiry pattern checked later, specific, matches the phrase n8n uses when a wait node times out.
An approval expiry that happens to involve a note with "JSON" in its title will match the data-contract pattern before it ever reaches the expiry pattern. The classifier stops at the first hit.
After the fix, the order is:
- Approval expiry pattern checked first.
- Data-contract failure pattern checked after.
That is the entire change. One reorder. No regex was rewritten, no alert wording changed.
The Structural Problem
The root cause is not the regex itself. It is that the classifier is running over free text that carries user content.
n8n's error strings are designed to be human-readable. Embedding the item title is useful when you are reading logs. It is a liability when a machine is pattern-matching that same string to decide what kind of fault occurred.
User content is unpredictable. A note title can contain anything: JSON, SQL, error codes, HTTP status numbers. Any of those could shadow a legitimate fault pattern or, as here, trigger a false one.
The General Rule
Two things would prevent this class of bug entirely:
- Classify on fields you control. Error codes, status enums, node names, execution metadata. These are structured and predictable. A user cannot accidentally write a note title that looks like error code 4201.
- Match expected outcomes first. If a state is known and recoverable, label it before running any content-based patterns. A normal timeout should never lose a race to a broad regex.
The second rule is a cheaper fix when you cannot immediately restructure the classifier. It is what shipped here.
What the Repair Record Says
The dil.dev n8n README repair log for 23 October 2026 records the incident and names the handler file. It confirms the fix is the match ordering, not a change to the underlying patterns. That is worth noting because it would be easy to assume the regex needed tightening. It did not. The regex was fine. The sequence was wrong.
This is a common shape of bug: the individual components are correct, the composition is not.
Checking Your Own Classifiers
If you have a shared error handler that uses regex or string matching, it is worth asking:
- Does the error string include any user-supplied content? Item titles, message bodies, field values, filenames.
- Are your broadest patterns evaluated before your most specific ones? Broad patterns will win if they appear first.
- Do you have patterns for expected, non-fault outcomes? Approval waits, rate-limit retries, scheduled pauses. If not, those states will fall through to whatever fault pattern is closest.
A quick audit of the match order costs almost nothing. A false data-contract alert at the wrong moment costs attention and trust in the alerting system.
What I'd do differently
I would not embed the queue item title in the error string that the classifier reads. Keep it in a separate field, available for logging and human inspection, but not in the string the machine matches against.
If I had done that from the start, the match order would not have mattered. The classifier would never have seen the word "JSON" from the title because it would not have been in the text it was scanning.
The fix that shipped is correct and sufficient. But it is a mitigation, not a structural solution. The structural solution is to keep user content out of the signal the classifier uses.




