stanfordnlp/CoreNLP · error · IllegalArgumentException

Not a valid ellipses style

Error message

Not a valid ellipses style: ${value}

What it means

The generated SpanishLexer (JFlex-based) accepts options passed to its constructor, including 'ellipses' which controls how '...' is tokenized. The value must be a valid LexerUtils.EllipsesEnum constant; if Enum.valueOf fails, the lexer rethrows an IllegalArgumentException reporting the invalid value.

Solutions

  1. Use a valid EllipsesEnum value, e.g. 'unicode', 'delete', or 'leave' (matching LexerUtils.EllipsesEnum, compared upper-case).
  2. Check the accepted names in LexerUtils.EllipsesEnum for your library version.
  3. Wrap lexer construction in try-catch for IllegalArgumentException and fall back to the default ellipses style.
  4. Validate the config value before passing it to the lexer.

Example fix

// before
new SpanishLexer(new InputStreamReader(in), "ellipses=three-dots");
// after
new SpanishLexer(new InputStreamReader(in), "ellipses=unicode");
Defensive patterns

Strategy: validation

Validate before calling

String v = value.trim().toUpperCase(Locale.ROOT);
boolean ok = java.util.Arrays.stream(LexerUtils.EllipsesEnum.values())
    .anyMatch(e -> e.name().equals(v));
if (!ok) throw new IllegalArgumentException("Bad ellipses option: " + value);

Type guard

static boolean isValidEllipsesStyle(String value) {
  if (value == null) return false;
  String v = value.trim().toUpperCase(Locale.ROOT);
  for (LexerUtils.EllipsesEnum e : LexerUtils.EllipsesEnum.values())
    if (e.name().equals(v)) return true;
  return false;
}

Try / catch

try {
  lexer = new SpanishLexer(reader, options);
} catch (IllegalArgumentException e) {
  if (e.getMessage().contains("Not a valid ellipses style")) {
    lexer = new SpanishLexer(reader, options.replaceAll("ellipses=[^,]*", "ellipses=unicode"));
  } else { throw e; }
}

Prevention

When it happens

Trigger: Constructing SpanishLexer with options containing key 'ellipses' and a value that is not a valid EllipsesEnum name (after trim and uppercase), e.g. 'dots', 'three-dots', 'unicode', or an empty string. Valid values are the EllipsesEnum constants (e.g. UNICODE, DELETE, LEAVE).

Common situations: Config files (tokenizer options in properties files) written with free-form values; copying PTBTokenizer option values that don't exist for this lexer; typos or lowercase-with-hyphens style values; upgrading the parser and using enum names removed/renamed in LexerUtils.

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


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/bdc6856bd71e8ece. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/international/spanish/process/SpanishLexer.java:14152

            normalizeOtherBrackets = val;
            ellipsisStyle = val ? LexerUtils.EllipsesEnum.ASCII : LexerUtils.EllipsesEnum.ORIGINAL;
            dashesStyle = val ? LexerUtils.DashesEnum.ASCII : LexerUtils.DashesEnum.ORIGINAL;
            quoteStyle = val ? LexerUtils.QuotesEnum.ASCII : LexerUtils.QuotesEnum.ORIGINAL;
          } else if ("quotes".equals(key)) {
            quoteStyle = LexerUtils.QuotesEnum.valueOf(key.trim().toLowerCase(Locale.ROOT));
          } else if ("normalizeAmpersandEntity".equals(key)) {
            normalizeAmpersandEntity = val;
          } else if ("normalizeFractions".equals(key)) {
            normalizeFractions = val;
          } else if ("normalizeParentheses".equals(key)) {
            normalizeParentheses = val;
          } else if ("normalizeOtherBrackets".equals(key)) {
            normalizeOtherBrackets = 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":

View on GitHub (pinned to 1b7edd19c4)