stanfordnlp/CoreNLP · error · IllegalStateException
Something went very very wrong.
Error message
Something went very very wrong.
What it means
Trilean.toBoolean(Boolean valueForUnknown) throws IllegalStateException when the internal value field holds an integer outside {0,1,2}. Since all constructors confine value to those three states, reaching the default branch means internal corruption — hence 'very very wrong'.
Solutions
- Do not construct Trilean via reflection or raw deserialization across versions; use fromString/TRUE/FALSE/UNKNOWN.
- Catch IllegalStateException as an unrecoverable bug and fail fast.
- Recreate the Trilean from a known representation instead of trusting the corrupted one.
Defensive patterns
Strategy: try-catch
Try / catch
try {
boolean b = t.toBoolean(Boolean.FALSE);
} catch (IllegalStateException e) {
t = Trilean.fromString(t.toString()); // or rebuild; this is an internal bug
} Prevention
- Only build Trilean via public constructors/constants/fromString.
- Avoid reflection on the private value field.
- Don't Java-serialize Trilean across library versions; use its string form.
When it happens
Trigger: Calling toBoolean on a Trilean whose internal value was corrupted via reflection or deserialization of an object built by a different (incompatible) class version.
Common situations: Java serialization of Trilean across library versions where the state encoding changed; tests tampering with the private field via reflection.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- adjustFinalToken: Unexpected final char: |
- Cannot parse Trilean from string: " + value
- Coordination node must have at least 2 children.
- edge cliqueFeatures[n]=
- Either logic is broken or Gabor can't code.
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/deed570da2b4d68c.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/util/Trilean.java:90
public boolean isUnknown() {
return value == 2;
}
/**
* Convert this Trilean to a boolean, with a specified default value if the truth value is unknown.
* @param valueForUnknown The default value to use if the value of this Trilean is unknown.
* @return The boolean value of this Trilean.
*/
public boolean toBoolean(boolean valueForUnknown) {
switch (value) {
case 1:
return true;
case 0:
return false;
case 2:
return valueForUnknown;
default:
throw new IllegalStateException("Something went very very wrong.");
}
}
/**
* Convert this Trilean to a Boolean, or null if the value is not known.
* @return Either True, False, or null.
*/
public Boolean toBooleanOrNull() {
switch (value) {
case 1:
return true;
case 0:
return false;
case 2:
return null;
default:
throw new IllegalStateException("Something went very very wrong.");
}View on GitHub (pinned to 1b7edd19c4)