stanfordnlp/CoreNLP · error · IllegalArgumentException

FrenchLexer: Invalid option value in constructor: :

Error message

FrenchLexer: Invalid option value in constructor: : 

What it means

The FrenchLexer options constructor iterates key/value pairs and throws this IllegalArgumentException in the default case of the 'untokenizable' switch, or generally when an option value is invalid for its key. It signals an unrecognized or unsupported option value passed to the constructor.

Solutions

  1. Use an exact valid untokenizable value: noneDelete, noneKeep, firstDelete, firstKeep, allDelete, allKeep
  2. Check the option key spelling; unknown keys are only logged to stderr, invalid values throw
  3. Compare against the switch cases in FrenchLexer's options constructor
  4. Validate the options string programmatically before constructing

Example fix

// before
new FrenchLexer("untokenizable=allkeep");
// after
new FrenchLexer("untokenizable=allKeep");
Defensive patterns

Strategy: validation

Validate before calling

java.util.Set<String> ok = java.util.Set.of("noneDelete","noneKeep","firstDelete","firstKeep","allDelete","allKeep");
if (!ok.contains(untokenizableValue)) throw new IllegalArgumentException("Bad untokenizable value: " + untokenizableValue);

Type guard

boolean isValidUntokenizable(String v) { return java.util.Set.of("noneDelete","noneKeep","firstDelete","firstKeep","allDelete","allKeep").contains(v); }

Try / catch

try { lexer = new FrenchLexer(optionsString); } catch (IllegalArgumentException e) { log.error("Invalid FrenchLexer option: " + e.getMessage()); throw new ConfigurationException(e); }

Prevention

When it happens

Trigger: Passing an option string where 'untokenizable' has a value other than noneDelete/noneKeep/firstDelete/firstKeep/allDelete/allKeep, or any other key with an unparseable value reaching the default branch.

Common situations: Typo like 'untokenizable=allkeep' (needs exact mixed-case match), copying PTBTokenizer options that FrenchLexer does not support, hand-edited configuration files.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/international/french/process/FrenchLexer.java:12441

              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":
              untokenizable = UntokenizableOptions.FIRST_KEEP;
              break;
            case "allKeep":
              untokenizable = UntokenizableOptions.ALL_KEEP;
              break;
            default:
              throw new IllegalArgumentException("FrenchLexer: Invalid option value in constructor: " + key + ": " + value);
          }
        } else if ("strictTreebank3".equals(key)) {
          strictTreebank3 = val;
        } else {
          System.err.printf("%s: Invalid options key in constructor: %s%n", this.getClass().getName(), key);
        }
      }
      // this.seenUntokenizableCharacter = false; // unnecessary, it's default initialized
      if (invertible) {
        if ( ! (tf instanceof CoreLabelTokenFactory)) {
          throw new IllegalArgumentException("FrenchLexer: the invertible option requires a CoreLabelTokenFactory");
        }
        prevWord = (CoreLabel) tf.makeToken("", 0, 0);
        prevWordAfter = new StringBuilder();
      }
    }

View on GitHub (pinned to 1b7edd19c4)