{"record":{"id":"a8eef31f386eba7f","repo":"languagetool-org/languagetool","slug":"triggers-error-is-not-supported-for-false-friend","errorCode":null,"errorMessage":"'triggers_error' is not supported for false friend XML","messagePattern":"'triggers_error' is not supported for false friend XML","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"languagetool-core/src/main/java/org/languagetool/rules/patterns/FalseFriendRuleHandler.java","lineNumber":120,"sourceCode":"      if (Languages.isLanguageSupported(languageStr)) {\n        Language tmpLang = Languages.getLanguageForShortCode(languageStr);\n        currentTranslationLanguage = tmpLang;\n        if (inTestMode && currentTranslationLanguage == language) {\n          throw new RuntimeException(\"Translation language (\" + currentTranslationLanguage + \") must not be the same as pattern language (\" + language + \") for rule \" + id);\n        }\n        if (tmpLang.equalsConsiderVariantsIfSpecified(motherTongue)) {\n          translationLanguage = tmpLang;\n        }\n      }\n    } else if (qName.equals(EXAMPLE)) {\n      correctExample = new StringBuilder();\n      incorrectExample = new StringBuilder();\n      if (attrs.getValue(TYPE).equals(\"incorrect\")) {\n        inIncorrectExample = true;\n      } else if (attrs.getValue(TYPE).equals(\"correct\")) {\n        inCorrectExample = true;\n      } else if (attrs.getValue(TYPE).equals(\"triggers_error\")) {\n        throw new RuntimeException(\"'triggers_error' is not supported for false friend XML\");\n      }\n    } else if (qName.equals(MESSAGE)) {\n      inMessage = true;\n      message = new StringBuilder();\n    } else if (qName.equals(RULEGROUP)) {\n      ruleGroupId = attrs.getValue(\"id\");\n      inRuleGroup = true;\n      defaultOff = \"off\".equals(attrs.getValue(DEFAULT));\n    }\n  }\n\n  @Override\n  public void endElement(String namespaceURI, String sName,\n      String qName) throws SAXException {\n    switch (qName) {\n      case RULE:\n        if (language.equalsConsiderVariantsIfSpecified(textLanguage) && translationLanguage != null\n                && translationLanguage.equalsConsiderVariantsIfSpecified(motherTongue) && language != motherTongue","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-core/src/main/java/org/languagetool/rules/patterns/FalseFriendRuleHandler.java#L102-L138","documentation":"The false-friend XML schema only supports example types 'correct' and 'incorrect'. When the parser encounters an <example type=\"triggers_error\"> element — a construct valid in grammar-rule XML but not in false-friend XML — it throws this RuntimeException.","triggerScenarios":"A <translation>/<example> element with type=\"triggers_error\" inside a false-friend XML file processed by FalseFriendRuleHandler.startElement.","commonSituations":"Copy-pasting example markup from regular grammar rule XML into false-friends.xml, or writing false-friend rules using the wrong schema reference/autocomplete template.","solutions":["Remove the type=\"triggers_error\" attribute from the example element in the false-friend XML","Use only type=\"correct\" or type=\"incorrect\" in false-friend XML files","Validate the file against the false-friend XML schema (false-friends rules use a different DTD/schema than pattern rules)"],"exampleFix":"// before\n<example type=\"triggers_error\">He gave me a tip.</example>\n// after\n<example type=\"incorrect\">He gave me a tip.</example>","handlingStrategy":"validation","validationCode":"if (doc.getElementsByAttributeValue(\"type\", \"triggers_error\").size() > 0) {\n  throw new IllegalArgumentException(\"triggers_error not allowed in false-friend XML\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  rules = loader.getRules(file, language, motherTongue);\n} catch (RuntimeException e) {\n  if (e.getMessage().contains(\"triggers_error\")) {\n    log.error(\"Remove triggers_error examples from {}\", file);\n    return Collections.emptyList();\n  }\n  throw e;\n}","preventionTips":["Use the correct schema/DTD for false-friend XML, not grammar-rule XML","Only use example types 'correct' and 'incorrect' in false-friend files","Add a pre-commit XML validation step for rule resources"],"tags":["false-friend","rule-xml","unsupported-attribute","xml-parsing"],"backgroundTag":"unsupported-config-value","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"}