stanfordnlp/CoreNLP · error · RuntimeException
Unknown entry " " in dictionary " "!
Error message
Unknown entry "${s}" in dictionary "${mName}"! What it means
RuntimeException from StringDictionary.get(String,boolean) when shouldThrow is true and the string s is not present in the named dictionary (mName). It is a lookup guard used by machine-reading components for known entity/role strings; unknown tokens are fatal when strict lookups are requested.
Solutions
- Call get with shouldThrow=false to get -1 for unknown entries
- Pre-populate the dictionary or enable mCreate so unknown strings are added
- Check token normalization (case, whitespace) before lookup
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at src/edu/stanford/nlp/ie/machinereading/common/StringDictionary.java:95 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/2ac6992c163ddd02.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/ie/machinereading/common/StringDictionary.java:95
* if it does not exist. If mCreate is true, the count of the entry is
* incremented for every get If no entry found throws an exception if
* shouldThrow == true
*/
public int get(String s, boolean shouldThrow) {
IndexAndCount ic = mDict.get(s);
if (mCreate) {
if (ic == null) {
ic = new IndexAndCount(mDict.size(), 0);
mDict.put(s, ic);
mInverse.put(Integer.valueOf(ic.mIndex), s);
}
ic.mCount++;
}
if (ic != null)
return ic.mIndex;
if (shouldThrow) {
throw new RuntimeException("Unknown entry \"" + s + "\" in dictionary \"" + mName + "\"!");
} else {
return -1;
}
}
public static final String NIL_VALUE = "nil";
/**
* Reverse mapping from integer key to string value
*/
public String get(int idx) {
if (idx == -1)
return NIL_VALUE;
String s = mInverse.get(idx);
if (s == null)
throw new RuntimeException("Unknown index \"" + idx + "\" in dictionary \"" + mName + "\"!");
return s;View on GitHub (pinned to 1b7edd19c4)