stanfordnlp/CoreNLP · error · IllegalArgumentException
entitySubclassify: unknown style:
Error message
entitySubclassify: unknown style:
What it means
IOBUtils.entitySubclassify rewrites IOB-style entity tags into one of several supported styles (io, io2, iob1, iob2, iobes, bieo, bilou). Any other style string hits the switch default and throws IllegalArgumentException('entitySubclassify: unknown style: ' + style).
Solutions
- Use one of the supported lowercase styles: io, io2, iob1, iob2, iobes, bieo, bilou.
- Normalize the incoming style string with toLowerCase() before passing it in.
- Remove or fix the config/property supplying the invalid style value.
Example fix
// before entitySubclassify(tokens, "BILOU", ...); // after entitySubclassify(tokens, "bilou", ...);
Defensive patterns
Strategy: validation
Validate before calling
static final Set<String> STYLES = Set.of("io","io2","iob1","iob2","iobes","bieo","bilou");
if (!STYLES.contains(style.toLowerCase())) throw new IllegalArgumentException("bad entitySubclassify style: " + style); Prevention
- Use the documented lowercase style names.
- Normalize config values with toLowerCase().trim() before calling.
- List valid values in config validation/error messages.
When it happens
Trigger: Calling entitySubclassify(tokens, style, ...) with a style string not in {io, io2, iob1, iob2, iobes, bieo, bilou} — e.g. "BILOU" (case-sensitive switch) or "iobes+", at IOBUtils.java:92.
Common situations: Passing a dataset config value like "BILOU" or "conll" as the sub-classification style; typos; env/config where the style string comes from user-supplied properties.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Arabic does not support feature type: " + feat.toString()
- Array lengths don't match
- Attempting to remove features based on weight from a…
- Cannot normalize ner tag
- Cannot retrain before you train!
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/d246e3226649253d.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/sequences/IOBUtils.java:92
break;
case "ioe2":
how = 3;
break;
case "io":
how = 4;
break;
case "sbieo":
case "iobes":
how = 5;
break;
case "noprefix":
how = 6;
break;
case "bilou":
how = 7;
break;
default:
throw new IllegalArgumentException("entitySubclassify: unknown style: " + style);
}
List<TOK> paddedTokens = new PaddedList<>(tokens, (TOK) new CoreLabel());
int size = paddedTokens.size();
String[] newAnswers = new String[size];
for (int i = 0; i < size; i++) {
TOK c = paddedTokens.get(i);
TOK p = paddedTokens.get(i - 1);
TOK n = paddedTokens.get(i + 1);
String cAns = c.get(key);
String pAns = p.get(key);
if (pAns == null) {
pAns = backgroundLabel;
}
String nAns = n.get(key);
if (nAns == null) {
nAns = backgroundLabel;
}
String base;View on GitHub (pinned to 1b7edd19c4)