languagetool-org/languagetool · error
Could not tag and disambiguate '<token>'
Error message
Could not tag and disambiguate '<token>'
What it means
NoDisambiguationIrishPartialPosTagFilter.tag calls the Irish tagger without disambiguation and rethrows any IOException as this RuntimeException identifying the token. Despite the message wording, no disambiguation step runs here — the failure is purely in tagging (dictionary/resource I/O).
Source
Thrown at languagetool-language-modules/ga/src/main/java/org/languagetool/rules/ga/NoDisambiguationIrishPartialPosTagFilter.java:47
import java.util.List;
/**
* A {@link PartialPosTagFilter} for Irish that does not run the disambiguator.
* @since 3.2
* @see IrishPartialPosTagFilter
*/
public class NoDisambiguationIrishPartialPosTagFilter extends PartialPosTagFilter {
private final Tagger tagger = Irish.getInstance().getTagger();
@Override
protected List<AnalyzedTokenReadings> tag(String token) {
try {
List<AnalyzedTokenReadings> tags = tagger.tag(Collections.singletonList(token));
AnalyzedTokenReadings[] atr = tags.toArray(new AnalyzedTokenReadings[tags.size()]);
return Arrays.asList(atr);
} catch (IOException e) {
throw new RuntimeException("Could not tag and disambiguate '" + token + "'", e);
}
}
}
View on GitHub (pinned to 2e990059ce)
Solutions
- Inspect the wrapped IOException cause to find the unreadable/missing resource and restore it.
- Verify the Irish language module (dictionaries) is fully present on the classpath.
- Fix filesystem permissions on the LanguageTool resource directory.
- Consider caching the tagger instance and pre-warming resource loading at startup to surface resource problems early.
Example fix
// before
try { return tagger.tag(...); } catch (IOException e) { throw new RuntimeException("Could not tag...", e); }
// after (fail fast at init)
@FunctionalInterface interface SafeTag { List<AnalyzedTokenReadings> apply(String t); }
// validate resources once in constructor: tagger.tag(List.of("tá")) before accepting traffic Defensive patterns
Strategy: try-catch
Validate before calling
List<AnalyzedTokenReadings> probe = tagger.tag(List.of("tá"));
if (probe == null || probe.isEmpty()) throw new IllegalStateException("Irish tagger not operational"); Try / catch
try { return tag(token); } catch (RuntimeException e) { log.error("Tagging failed for '" + token + "'", e.getCause()); return Collections.emptyList(); } Prevention
- Pre-warm the tagger at startup to surface missing resources early
- Keep the full Irish language module on the classpath
- Fix message wording confusion: this filter never runs disambiguation
When it happens
Trigger: tagger.tag(Collections.singletonList(token)) throws IOException — missing or unreadable Irish tagger dictionary resources on the classpath while a POS filter processes a token.
Common situations: Incomplete or custom LanguageTool deployments lacking ga resources; classloader issues in embedded/plugin environments; corrupted resource files after partial upgrades.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- Could not tag and disambiguate '<token>'
- Could not load coherency data from " + path
- Could not tag and disambiguate '" + token + "'
- Error analyzing sentence: '" + match.getSentence().getText()
- Language was already instantiated, see the cause stacktrace
AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06).
Data as JSON: /api/errors/88ab02cca8a094ee.
Report an issue: GitHub.