{"record":{"id":"c9ab7a382fcecd2f","repo":"languagetool-org/languagetool","slug":"too-many-values-valuecount-the-storage-c9ab7a","errorCode":null,"errorMessage":"Too many values (\" + valueCount + \"), the storage needs adjusting","messagePattern":"Too many values \\(\" \\+ valueCount \\+ \"\\), the storage needs adjusting","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"languagetool-core/src/main/java/org/languagetool/tagging/ManualTagger.java","lineNumber":69,"sourceCode":"  private static final int MAX_OFFSET = (1 << 32 - OFFSET_SHIFT) - 1;\n  private static final int ENTRY_SIZE = 2;\n  private final String[] data;\n\n  /** A map from inflected forms to encoded lemma+POS pair offsets in {@link #data} */\n  private final Object2IntMap<String> map;\n\n  public ManualTagger(InputStream inputStream) throws IOException {\n    this(inputStream, false);\n  }\n\n  public ManualTagger(InputStream inputStream, boolean internTags) throws IOException {\n    Map<String, List<TaggedWord>> mapping = loadMapping(inputStream, internTags);\n    map = new Object2IntOpenHashMap<>(mapping.size());\n    int valueCount = mapping.values().stream().mapToInt(v -> v.size()).sum();\n    int firstIndex = ENTRY_SIZE; // skip an entry, as 0 means an absent value in TObjectIntHashMap\n    data = new String[valueCount * ENTRY_SIZE + firstIndex];\n    if (valueCount > MAX_OFFSET) {\n      throw new UnsupportedOperationException(\"Too many values (\" + valueCount + \"), the storage needs adjusting\");\n    }\n    int index = firstIndex;\n    for (Map.Entry<String, List<TaggedWord>> entry : mapping.entrySet()) {\n      List<TaggedWord> value = entry.getValue();\n      if (value.size() > MAX_LENGTH) {\n        throw new UnsupportedOperationException(\n          \"Too many lemmas (\" + value.size() + \" > \" + MAX_LENGTH + \" for \" + entry.getKey() + \"), the storage needs adjusting\");\n      }\n      map.put(entry.getKey(), ((index / ENTRY_SIZE) << OFFSET_SHIFT) | value.size());\n      for (TaggedWord tw : value) {\n        data[index++] = intern(tw.getLemma());\n        data[index++] = intern(tw.getPosTag());\n      }\n    }\n  }\n\n  private static Map<String, List<TaggedWord>> loadMapping(InputStream inputStream, boolean internTags) throws IOException {\n    Map<String, List<TaggedWord>> map = new HashMap<>();","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-core/src/main/java/org/languagetool/tagging/ManualTagger.java#L51-L87","documentation":"Capacity guard in the ManualTagger binary storage builder: the total number of lemma+POS values across the whole manual tagging dictionary exceeds MAX_OFFSET, the largest value encodable in the bit-shifted offset field. This is a hard internal data-size limit of the packed String[] representation, hit only by pathologically large manual dictionaries.","triggerScenarios":"Thrown at languagetool-core/src/main/java/org/languagetool/tagging/ManualTagger.java:69 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Split the manual additions file into smaller dictionaries or reduce its number of entries","Increase OFFSET_SHIFT/MAX_OFFSET in ManualTagger and rebuild to widen the offset storage"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}