stanfordnlp/CoreNLP · warning

Unrecognized option

Error message

Unrecognized option: ${key}

What it means

ArgumentParser.fillOptionsImpl, when ensureAllOptions is enabled, treats every property key as 'ClassName.fieldName'. If the key has no dot it cannot map to a class field and is reported as an unrecognized option (skipped).

Solutions

  1. Use the fully-qualified form 'fully.qualified.ClassName.fieldName' for the property key
  2. Declare the option as a public static field on a class and reference it with the dotted path
  3. Set ensureAllOptions=false if unknown keys should be silently ignored
  4. Remove or rename the malformed key

Example fix

// before
verbose=true
// after
edu.stanford.nlp.pipeline.StanfordCoreNLP.verbose=true
Defensive patterns

Strategy: validation

Validate before calling

for (String key : props.stringPropertyNames()) {
  if (ensureAllOptions && !key.contains("."))
    throw new IllegalArgumentException("option key must be Class.field: " + key);
}

Try / catch

try {
  ArgumentParser.fillOptions(cls, props, true);
} catch (RuntimeException e) {
  log.error("bad properties: " + e.getMessage());
}

Prevention

When it happens

Trigger: Passing a properties entry whose key contains no '.' (e.g. 'verbose=true') to fillOptions(..., ensureAllOptions=true) or bootstrapMap with the same flag.

Common situations: Users writing flat properties keys instead of fully-qualified option names; copying config from another tool; typos that drop the class prefix.

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/0b0dd5ecbee85e6f. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/util/ArgumentParser.java:440

      // (get values)
      String value = entry.getValue().toString();
      assert value != null;
      Field target = canFill.get(key);
      // (mark required option as fulfilled)
      Pair<Boolean, Boolean> mark = required.get(key);
      if (mark != null && mark.first) {
        required.put(key, Pair.makePair(true, true));
      }
      // (fill the field)
      if (target != null) {
        // (case: declared option)
        fillField(class2object.get(target.getDeclaringClass()), target, value);
      } else if (ensureAllOptions) {
        // (case: undeclared option)
        // split the key
        int lastDotIndex = rawKeyStr.lastIndexOf('.');
        if (lastDotIndex < 0) {
          err("Unrecognized option: " + key);
          continue;
        }
        if (!rawKeyStr.startsWith("log.")) {  // ignore Redwood options
          String className = rawKeyStr.substring(0, lastDotIndex);
          // get the class
          Class clazz = null;
          try {
            clazz = ClassLoader.getSystemClassLoader().loadClass(className);
          } catch (Exception e) {
            err("Could not set option: " + entry.getKey() + "; either the option is mistyped, not defined, or the class " + className + " does not exist.");
          }
          // get the field
          if (clazz != null) {
            String fieldName = rawKeyStr.substring(lastDotIndex + 1);
            try {
              target = clazz.getField(fieldName);
            } catch (Exception e) {
              err("Could not set option: " + entry.getKey() + "; no such field: " + fieldName + " in class: " + className);

View on GitHub (pinned to 1b7edd19c4)