{"record":{"id":"542c2100cfa94d8c","repo":"languagetool-org/languagetool","slug":"elements-with-only-match-references-e-g-1-are","errorCode":null,"errorMessage":"Elements with only match references (e.g. \\1) are not supported.","messagePattern":"Elements with only match references \\(e\\.g\\. \\\\1\\) are not supported\\.","errorType":"exception","errorClass":"UnsupportedPatternRuleException","httpStatus":null,"severity":"error","filePath":"languagetool-wikipedia/src/main/java/org/languagetool/dev/index/PatternRuleQueryBuilder.java","lineNumber":252,"sourceCode":"      }\n      return new RegexpQuery(term);\n    } catch (IllegalArgumentException e) {\n      // constructs like \"\\p{Punct}\" not supported by Lucene RegExp:\n      throw new UnsupportedPatternRuleException(\"Advanced regex like '\\\\p{Punct}' are not supported: \" + patternToken);\n    }\n  }\n\n  private void checkUnsupportedElement(PatternToken patternPatternToken)\n      throws UnsupportedPatternRuleException {\n    if (patternPatternToken.hasOrGroup()) {\n      // TODO: this is not enough: the first of the tokens in the <or> group will not get into this branch\n      throw new UnsupportedPatternRuleException(\"<or> not yet supported.\");\n    }\n    if (patternPatternToken.isUnified()) {\n      throw new UnsupportedPatternRuleException(\"Elements with unified tokens are not supported.\");\n    }\n    if (patternPatternToken.getString() != null && patternPatternToken.getString().matches(\"\\\\\\\\\\\\d+\")) { // e.g. \"\\1\"\n      throw new UnsupportedPatternRuleException(\"Elements with only match references (e.g. \\\\1) are not supported.\");\n    }\n  }\n\n}\n","sourceCodeStart":234,"sourceCodeEnd":257,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-wikipedia/src/main/java/org/languagetool/dev/index/PatternRuleQueryBuilder.java#L234-L257","documentation":"Search-index guard in checkUnsupportedElement: the pattern element contains only back-references like \\1 and no term or POS of its own, so nothing indexable remains for Lucene.","triggerScenarios":"Thrown at languagetool-wikipedia/src/main/java/org/languagetool/dev/index/PatternRuleQueryBuilder.java:252 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Add a term or POS tag to the element","Skip the rule when building index queries"],"exampleFix":null,"handlingStrategy":"fallback","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-14T00:17:10.932Z"}