{"record":{"id":"410a3545bc278fac","repo":"languagetool-org/languagetool","slug":"could-not-tag-term","errorCode":null,"errorMessage":"Could not tag '\" + term + \"'","messagePattern":"Could not tag '\" \\+ term \\+ \"'","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"languagetool-language-modules/en/src/main/java/org/languagetool/rules/en/translation/BeoLingusTranslator.java","lineNumber":220,"sourceCode":"    }\n    List<TranslationEntry> sortedList = new ArrayList<>(entriesSet);\n    Collections.sort(sortedList, (t1, t2) -> Integer.compare(t2.getItemCount(), t1.getItemCount()));\n    return sortedList;\n  }\n\n  @NotNull\n  private List<TranslationEntry> getTranslationsForBaseforms(String term, Map<String, List<TranslationEntry>> map) {\n    List<TranslationEntry> result = new ArrayList<>();\n    try {\n      List<AnalyzedTokenReadings> readings = tagger.tag(Collections.singletonList(term));\n      readings.addAll(tagger.tag(Collections.singletonList(StringTools.uppercaseFirstChar(term))));  // user can spell German noun lowercase here\n      for (AnalyzedTokenReadings reading : readings) {\n        List<AnalyzedToken> aTokens = reading.getReadings();\n        addResultsForTokens(map, aTokens, result);\n      }\n      return result;\n    } catch (IOException e) {\n      throw new RuntimeException(\"Could not tag '\" + term + \"'\", e);\n    }\n  }\n\n  private void addResultsForTokens(Map<String, List<TranslationEntry>> map, List<AnalyzedToken> aTokens, List<TranslationEntry> result) {\n    for (AnalyzedToken aToken : aTokens) {\n      String lemma = aToken.getLemma();\n      if (lemma != null) {\n        List<TranslationEntry> tmp = map.get(lemma.toLowerCase());\n        if (tmp != null) {\n          for (TranslationEntry tmpEntry : tmp) {\n            if (!result.contains(tmpEntry)) {\n              TranslationEntry entry = cleanTranslationEntry(tmpEntry, aToken);\n              if (entry != null) {\n                result.add(entry);\n              }\n            }\n          }\n        }","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-language-modules/en/src/main/java/org/languagetool/rules/en/translation/BeoLingusTranslator.java#L202-L238","documentation":"getTranslationsForBaseforms first tags the input term with the English tagger, then looks up translations. If the tagging step throws IOException (tagger resource/IO failure), it is wrapped in a RuntimeException with the message 'Could not tag <term>', preserving the cause.","triggerScenarios":"Calling translationsForBaseforms (via getTranslationsForBaseforms) when the underlying tagger's tag() call throws IOException — typically missing or unreadable tagger dictionary resources.","commonSituations":"Running with a broken/incomplete languagetool-language-modules-en build where tagging data is missing; resource loading failures in packaged jars; corrupted language module installation.","solutions":["Check the wrapped IOException cause to identify which tagger resource failed to load.","Rebuild/repair the English language module so tagger dictionaries are on the classpath.","Ensure the term being tagged is valid non-empty input the tagger can process."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (term == null || term.isBlank()) return Collections.emptyList();","typeGuard":null,"tryCatchPattern":"try {\n  List<TranslationEntry> r = translator.getTranslationsForBaseforms(term);\n} catch (RuntimeException e) {\n  if (e.getCause() instanceof IOException io) { /* handle missing tagger resources */ }\n}","preventionTips":["Ensure the English language module and tagger dictionaries are on the classpath","Log and inspect the cause IOException to find missing resources","Run a smoke test that tags a known word at startup"],"tags":["languagetool","tagging","io","translation"],"backgroundTag":"file-read-failed","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"}