languagetool-org/languagetool · error · UnsupportedOperationException
Too many lemmas (" + value.size() + " > " + MAX_LENGTH + " f
Error message
Too many lemmas (" + value.size() + " > " + MAX_LENGTH + " for " + entry.getKey() + "), the storage needs adjusting What it means
Per-entry capacity guard during ManualTagger construction: a single inflected form maps to more lemmas than MAX_LENGTH allows, which the packed data array cannot store for that entry. Fires when one word form in the manual tagging file has an implausibly large number of lemma+POS pairs, usually indicating malformed or duplicated lines.
Source
Thrown at languagetool-core/src/main/java/org/languagetool/tagging/ManualTagger.java:75
public ManualTagger(InputStream inputStream) throws IOException {
this(inputStream, false);
}
public ManualTagger(InputStream inputStream, boolean internTags) throws IOException {
Map<String, List<TaggedWord>> mapping = loadMapping(inputStream, internTags);
map = new Object2IntOpenHashMap<>(mapping.size());
int valueCount = mapping.values().stream().mapToInt(v -> v.size()).sum();
int firstIndex = ENTRY_SIZE; // skip an entry, as 0 means an absent value in TObjectIntHashMap
data = new String[valueCount * ENTRY_SIZE + firstIndex];
if (valueCount > MAX_OFFSET) {
throw new UnsupportedOperationException("Too many values (" + valueCount + "), the storage needs adjusting");
}
int index = firstIndex;
for (Map.Entry<String, List<TaggedWord>> entry : mapping.entrySet()) {
List<TaggedWord> value = entry.getValue();
if (value.size() > MAX_LENGTH) {
throw new UnsupportedOperationException(
"Too many lemmas (" + value.size() + " > " + MAX_LENGTH + " for " + entry.getKey() + "), the storage needs adjusting");
}
map.put(entry.getKey(), ((index / ENTRY_SIZE) << OFFSET_SHIFT) | value.size());
for (TaggedWord tw : value) {
data[index++] = intern(tw.getLemma());
data[index++] = intern(tw.getPosTag());
}
}
}
private static Map<String, List<TaggedWord>> loadMapping(InputStream inputStream, boolean internTags) throws IOException {
Map<String, List<TaggedWord>> map = new HashMap<>();
try (
InputStreamReader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
BufferedReader br = new BufferedReader(reader)
) {
String line;
int lineCount = 0;View on GitHub (pinned to 2e990059ce)
Solutions
- Check the manual additions file for the offending word form and remove duplicate/malformed lemma lines
- Split entries across distinct word forms or reduce the number of lemmas for that form
- Raise MAX_LENGTH in ManualTagger if legitimately more lemmas are needed
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at languagetool-core/src/main/java/org/languagetool/tagging/ManualTagger.java:75 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06).
Data as JSON: /api/errors/94b8b7b13c2172f5.
Report an issue: GitHub.