stanfordnlp/CoreNLP · error

Missing required option

Error message

Missing required option: ${interner.get(key)}   <in class: ${canFill.get(key).getDeclaringClass()}>

What it means

After filling fields, fillOptionsImpl verifies that every option declared as required (mark.first) was actually set (mark.second). For each unset required option it logs this message, marks it reported, sets good=false, and finally throws RuntimeException("Specified properties are not parsable or not valid!").

Solutions

  1. Add the missing property key 'fully.qualified.ClassName.optionName=value' as printed in the error
  2. Check the class's static usage/help or @Argument(required=true) declarations for required options
  3. Correct typos so the provided key exactly matches the declared option name
  4. Handle the resulting RuntimeException and print available options to the user

Example fix

// before
Properties props = new Properties(); // missing required 'file'
ArgumentParser.fillOptions(cls, props, true);
// after
props.setProperty("edu.stanford.nlp.tagger.maxent.MaxentTagger.file", "model.tagger");
ArgumentParser.fillOptions(cls, props, true);
Defensive patterns

Strategy: validation

Validate before calling

// declare required options explicitly before filling
Properties props = new Properties();
props.setProperty("my.pkg.MyClass.output", "out.txt");
// fail early if a known-required key is absent
for (String req : List.of("my.pkg.MyClass.output")) {
  if (!props.containsKey(req)) throw new IllegalArgumentException("missing required option: " + req);
}

Try / catch

try {
  ArgumentParser.fillOptions(cls, props, true);
} catch (RuntimeException e) {
  System.err.println("Check required options: " + e.getMessage());
  System.exit(2);
}

Prevention

When it happens

Trigger: Calling ArgumentParser.fillOptions for a class with a required @Argument/option without supplying a matching properties key, e.g. a class requiring 'output' but no 'pkg.Class.output=...' entry passed in.

Common situations: Incomplete properties files; forgetting a mandatory flag documented in a class's usage; copying a partial config example; typos so the provided key doesn't match the declared option name.

Understand the failure class

Background: "Must pass :limit option" / "Missing required option" — required option errors explained — this error's family across 41 libraries.

Related errors


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

Appendix: source

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

            }
            if (target != null) {
              log("option overrides " + target + " to '" + value + '\'');
              fillField(class2object.get(target.getDeclaringClass()), target, value);
            } else {
              err("Could not set option: " + entry.getKey() + "; no such field: " + fieldName + " in class: " + className);
            }
          }
        }
      }
    }

    //--Ensure Required
    boolean good = true;
    for (Map.Entry<String, Pair<Boolean, Boolean>> entry : required.entrySet()) {
      String key = entry.getKey();
      Pair<Boolean, Boolean> mark = entry.getValue();
      if (mark.first && !mark.second) {
        err("Missing required option: " + interner.get(key) + "   <in class: " + canFill.get(key).getDeclaringClass() + '>');
        required.put(key, Pair.makePair(true, true));  //don't duplicate error messages
        good = false;
      }
    }
    if ( ! good) {
      throw new RuntimeException("Specified properties are not parsable or not valid!");
      //System.exit(1);
    }

    return canFill;
  }

  @SuppressWarnings("UnusedReturnValue")
  private static Map<String, Field> fillOptionsImpl(
          Object[] instances,
          Class<?>[] classes,
          Properties options) {
    return fillOptionsImpl(instances, classes, options, strict, false);

View on GitHub (pinned to 1b7edd19c4)