languagetool-org/languagetool · error · IllegalStateException
'<marker>' may not be nested in rule '" + id + "'
Error message
'<marker>' may not be nested in rule '" + id + "'
What it means
SAX handler validation of disambiguation rule XML: a <marker> element appears inside another <marker> in an example, which cannot be represented since a marker denotes a single highlighted span. Fires at parse time of the disambiguation.xml for the offending rule.
Source
Thrown at languagetool-core/src/main/java/org/languagetool/tagging/disambiguation/rules/DisambiguationRuleHandler.java:269
untouchedExamples = new ArrayList<>();
}
if (disambExamples == null) {
disambExamples = new ArrayList<>();
}
untouched = attrs.getValue(TYPE).equals("untouched");
if (attrs.getValue(TYPE).equals("ambiguous")) {
input = attrs.getValue("inputform");
output = attrs.getValue("outputform");
}
example = new StringBuilder();
break;
case "filter":
filterClassName = attrs.getValue("class");
filterArgs = attrs.getValue("args");
break;
case MARKER:
if (inMarker) {
throw new IllegalStateException("'<marker>' may not be nested in rule '" + id + "'");
}
example.append("<marker>");
if (inPattern || inAntiPattern) {
startPos = tokenCounter;
inMarker = true;
}
break;
}
}
private void refNumberSanityCheck(int refNumber) throws SAXException {
if (refNumber > patternTokens.size()) {
throw new SAXException("Only backward references in match elements are possible, tried to specify token "
+ refNumber + "\n Line: " + pLocator.getLineNumber()
+ ", column: " + pLocator.getColumnNumber() + ".");
}
}
View on GitHub (pinned to 2e990059ce)
Solutions
- Remove or unnest the inner <marker> element in the rule's example text
- Keep at most one marker span per example, marking the matched tokens only
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at languagetool-core/src/main/java/org/languagetool/tagging/disambiguation/rules/DisambiguationRuleHandler.java:269 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06).
Data as JSON: /api/errors/ab8177c83a80babc.
Report an issue: GitHub.