{"record":{"id":"187ad9041c644c96","repo":"stanfordnlp/CoreNLP","slug":"unknown-index-idx-in-dictionary-mname","errorCode":null,"errorMessage":"Unknown index \"${idx}\" in dictionary \"${mName}\"!","messagePattern":"Unknown index \"(.+?)\" in dictionary \"(.+?)\"!","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/ie/machinereading/common/StringDictionary.java","lineNumber":112,"sourceCode":"    if (shouldThrow) {\n      throw new RuntimeException(\"Unknown entry \\\"\" + s + \"\\\" in dictionary \\\"\" + mName + \"\\\"!\");\n    } else {\n      return -1;\n    }\n  }\n\n  public static final String NIL_VALUE = \"nil\";\n\n  /**\n   * Reverse mapping from integer key to string value\n   */\n  public String get(int idx) {\n    if (idx == -1)\n      return NIL_VALUE;\n\n    String s = mInverse.get(idx);\n    if (s == null)\n      throw new RuntimeException(\"Unknown index \\\"\" + idx + \"\\\" in dictionary \\\"\" + mName + \"\\\"!\");\n    return s;\n  }\n\n  public int getCount(int idx) {\n    if (idx == -1)\n      return 0;\n\n    String s = mInverse.get(idx);\n    if (s == null)\n      throw new RuntimeException(\"Unknown index \\\"\" + idx + \"\\\" in dictionary \\\"\" + mName + \"\\\"!\");\n\n    return getIndexAndCount(s).mCount;\n  }\n\n  /**\n   * Saves all dictionary entries that appeared {@literal >} threshold times Note: feature\n   * indices are changed to contiguous values starting at 0. This is needed in\n   * order to minimize the memory allocated for the expanded feature vectors","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/ie/machinereading/common/StringDictionary.java#L94-L130","documentation":"RuntimeException from StringDictionary.get(int) when the integer index has no reverse mapping in the dictionary (and is not the -1 NIL sentinel); the caller passed an index outside the dictionary's populated range.","triggerScenarios":"Thrown at src/edu/stanford/nlp/ie/machinereading/common/StringDictionary.java:112 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use getCount/-1 sentinel checks before reverse lookups","Ensure the index came from the same dictionary instance that assigned it","Reload or rebuild the dictionary if it was truncated"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}