{"record":{"id":"98d851a530feef20","repo":"languagetool-org/languagetool","slug":"could-not-tag-and-disambiguate-token","errorCode":null,"errorMessage":"Could not tag and disambiguate '\" + token + \"'","messagePattern":"Could not tag and disambiguate '\" \\+ token \\+ \"'","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"languagetool-language-modules/fr/src/main/java/org/languagetool/rules/fr/FrenchPartialPosTagFilter.java","lineNumber":49,"sourceCode":"/**\n * A {@link PartialPosTagFilter} for French that also runs the disambiguator. Note\n * that the disambiguator is called with a single token, so only rules\n * will apply that have a single {@code <match>} element.\n *\n * @since 3.1\n */\npublic class FrenchPartialPosTagFilter extends PartialPosTagFilter {\n\n  @Override\n  protected List<AnalyzedTokenReadings> tag(String token) {\n    try {\n      var frenchLanguage = French.getInstance();\n      List<AnalyzedTokenReadings> tags = frenchLanguage.getTagger().tag(Collections.singletonList(token));\n      AnalyzedTokenReadings[] atr = tags.toArray(new AnalyzedTokenReadings[tags.size()]);\n      AnalyzedSentence disambiguated = frenchLanguage.getDisambiguator().disambiguate(new AnalyzedSentence(atr));\n      return Arrays.asList(disambiguated.getTokens());\n    } catch (IOException e) {\n      throw new RuntimeException(\"Could not tag and disambiguate '\" + token + \"'\", e);\n    }\n  }\n}\n","sourceCodeStart":31,"sourceCodeEnd":53,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-language-modules/fr/src/main/java/org/languagetool/rules/fr/FrenchPartialPosTagFilter.java#L31-L53","documentation":"FrenchPartialPosTagFilter.tag tags a single token with the French tagger and disambiguates it, wrapping any IOException from tagging/disambiguation in a RuntimeException. The token could not be POS-tagged and disambiguated, usually because the underlying language data failed to load or read.","triggerScenarios":"tag() calls French.getInstance().getTagger().tag(...) or getDisambiguator().disambiguate(...) and an IOException is raised — e.g. tagger dictionary files missing/corrupt on the classpath, or I/O failure while reading language resources — during acceptRuleMatch of a rule using this filter.","commonSituations":"Incomplete LanguageTool deployment (missing fr dictionary resources in languagetool-language-modules jar); custom builds without French data; low-level environment I/O problems (bad jar, permissions).","solutions":["Verify the French language module (languagetool-language-modules/fr resources: french tags dictionaries) is present and intact on the classpath.","Re-download/rebuild the LanguageTool distribution or fix the corrupted jar.","Check the wrapped IOException cause for the real file/resource path that failed and restore it.","Catch and log the RuntimeException at the rule-match level so one token failure does not abort the whole check run."],"exampleFix":"// before\nList<AnalyzedTokenReadings> tags = frenchLanguage.getTagger().tag(Collections.singletonList(token));\n// after\ntry {\n  List<AnalyzedTokenReadings> tags = frenchLanguage.getTagger().tag(Collections.singletonList(token));\n} catch (RuntimeException e) {\n  LOG.warn(\"POS tagging failed for token '\" + token + \"'\", e);\n  return Collections.emptyList();\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    List<AnalyzedTokenReadings> toks = filter.tag(token);\n} catch (RuntimeException e) {\n    LOG.error(\"Tagging failed for '\" + token + \"'\", e.getCause());\n    // degrade gracefully: skip this rule match\n}","preventionTips":["Ship the French language module resources (dictionaries) in your deployment.","Verify jar integrity after builds/updates.","Log the cause chain — the real reason is the wrapped IOException."],"tags":["java","languagetool","io","pos-tagger","french"],"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-14T00:17:10.932Z"}