stanfordnlp/CoreNLP · error · IllegalArgumentException
Not a valid dashes style
Error message
Not a valid dashes style: ${value} What it means
IllegalArgumentException from PTBLexer option parsing when the value given for the 'ellipses' option (or dashes style option) cannot be parsed into the corresponding LexerUtils enum; the options string passed to the tokenizer is invalid.
Solutions
- Use an exact LexerUtils.DashesEnum constant name (case-insensitive), e.g. dashes=unicode.
- Correct typos and remove decorators like '-dash' from the value.
- Align quotes/ellipses/dashes values to the same enum family supported by your CoreNLP version.
Example fix
// before
props.setProperty("tokenize.options", "dashes=em-dash");
// after
props.setProperty("tokenize.options", "dashes=unicode"); Defensive patterns
Strategy: validation
Validate before calling
boolean ok = Arrays.stream(LexerUtils.DashesEnum.values()).anyMatch(e -> e.name().equalsIgnoreCase(value.trim()));
if (!ok) throw new IllegalArgumentException("dashes must be a LexerUtils.DashesEnum name"); Try / catch
try { new PTBTokenizer<>(reader, factory, "dashes=" + style); } catch (IllegalArgumentException e) { if (e.getMessage().contains("dashes style")) { /* use default */ } else throw e; } Prevention
- Derive dashes/quotes/ellipses option strings from the corresponding enums programmatically.
- Reject unknown normalization values at config-load time.
- Test tokenizer construction once at startup rather than per-request.
When it happens
Trigger: Option map entry key="dashes" with a value outside DashesEnum, e.g. dashes=em-dash, dashes=hyphen, or dashes=unicode; (note the message text; the option here is dashes).
Common situations: Configuring normalization of dashes/quotes/ellipses together and using one consistent-but-wrong style name for all three; older ASCII-only expectations ported to newer CoreNLP where enum names differ.
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
- Not a valid ellipses style:
- Not a valid ellipses style:
- Not a valid ellipses style
- Not a valid quotes style:
- Not a valid quotes style
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/32ad1be359b57241.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/process/PTBLexer.java:61141
throw new IllegalArgumentException ("Not a valid quotes style: " + value);
}
} else if ("splitAssimilations".equals(key)) {
splitAssimilations = val;
} else if ("splitHyphenated".equals(key)) {
splitHyphenated = val;
} else if ("splitForwardSlash".equals(key)) {
splitForwardSlash = val;
} else if ("ellipses".equals(key)) {
try {
ellipsisStyle = LexerUtils.EllipsesEnum.valueOf(value.trim().toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException iae) {
throw new IllegalArgumentException ("Not a valid ellipses style: " + value);
}
} else if ("dashes".equals(key)) {
try {
dashesStyle = LexerUtils.DashesEnum.valueOf(value.trim().toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException iae) {
throw new IllegalArgumentException ("Not a valid dashes style: " + value);
}
} else if ("escapeForwardSlashAsterisk".equals(key)) {
escapeForwardSlashAsterisk = val;
} else if ("untokenizable".equals(key)) {
switch (value) {
case "noneDelete":
untokenizable = UntokenizableOptions.NONE_DELETE;
break;
case "firstDelete":
untokenizable = UntokenizableOptions.FIRST_DELETE;
break;
case "allDelete":
untokenizable = UntokenizableOptions.ALL_DELETE;
break;
case "noneKeep":
untokenizable = UntokenizableOptions.NONE_KEEP;
break;
case "firstKeep":View on GitHub (pinned to 1b7edd19c4)