{"record":{"id":"ab8177c83a80babc","repo":"languagetool-org/languagetool","slug":"marker-may-not-be-nested-in-rule-id","errorCode":null,"errorMessage":"'<marker>' may not be nested in rule '\" + id + \"'","messagePattern":"'<marker>' may not be nested in rule '\" \\+ id \\+ \"'","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"languagetool-core/src/main/java/org/languagetool/tagging/disambiguation/rules/DisambiguationRuleHandler.java","lineNumber":269,"sourceCode":"          untouchedExamples = new ArrayList<>();\n        }\n        if (disambExamples == null) {\n          disambExamples = new ArrayList<>();\n        }\n        untouched = attrs.getValue(TYPE).equals(\"untouched\");\n        if (attrs.getValue(TYPE).equals(\"ambiguous\")) {\n          input = attrs.getValue(\"inputform\");\n          output = attrs.getValue(\"outputform\");\n        }\n        example = new StringBuilder();\n        break;\n      case \"filter\":\n        filterClassName = attrs.getValue(\"class\");\n        filterArgs = attrs.getValue(\"args\");\n        break;\n      case MARKER:\n        if (inMarker) {\n          throw new IllegalStateException(\"'<marker>' may not be nested in rule '\" + id + \"'\");\n        }\n        example.append(\"<marker>\");\n        if (inPattern || inAntiPattern) {\n          startPos = tokenCounter;\n          inMarker = true;\n        }\n        break;\n    }\n  }\n\n  private void refNumberSanityCheck(int refNumber) throws SAXException {\n    if (refNumber > patternTokens.size()) {\n      throw new SAXException(\"Only backward references in match elements are possible, tried to specify token \"\n              + refNumber + \"\\n Line: \" + pLocator.getLineNumber()\n              + \", column: \" + pLocator.getColumnNumber() + \".\");\n    }\n  }\n","sourceCodeStart":251,"sourceCodeEnd":287,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-core/src/main/java/org/languagetool/tagging/disambiguation/rules/DisambiguationRuleHandler.java#L251-L287","documentation":"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.","triggerScenarios":"Thrown at languagetool-core/src/main/java/org/languagetool/tagging/disambiguation/rules/DisambiguationRuleHandler.java:269 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2e990059ce67d5e2a0f7f7ca5d31160c6709df4b","analyzedAt":"2026-09-06T09:20:17.015Z","contentChangedAt":"2026-09-06T09:20:17.015Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}