{"record":{"id":"f4cdc1241da26dce","repo":"stanfordnlp/CoreNLP","slug":"missing-required-option-interner-get-key-i","errorCode":null,"errorMessage":"Missing required option: ${interner.get(key)}   <in class: ${canFill.get(key).getDeclaringClass()}>","messagePattern":"Missing required option: (.+?)   <in class: (.+?)>","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/util/ArgumentParser.java","lineNumber":477,"sourceCode":"            }\n            if (target != null) {\n              log(\"option overrides \" + target + \" to '\" + value + '\\'');\n              fillField(class2object.get(target.getDeclaringClass()), target, value);\n            } else {\n              err(\"Could not set option: \" + entry.getKey() + \"; no such field: \" + fieldName + \" in class: \" + className);\n            }\n          }\n        }\n      }\n    }\n\n    //--Ensure Required\n    boolean good = true;\n    for (Map.Entry<String, Pair<Boolean, Boolean>> entry : required.entrySet()) {\n      String key = entry.getKey();\n      Pair<Boolean, Boolean> mark = entry.getValue();\n      if (mark.first && !mark.second) {\n        err(\"Missing required option: \" + interner.get(key) + \"   <in class: \" + canFill.get(key).getDeclaringClass() + '>');\n        required.put(key, Pair.makePair(true, true));  //don't duplicate error messages\n        good = false;\n      }\n    }\n    if ( ! good) {\n      throw new RuntimeException(\"Specified properties are not parsable or not valid!\");\n      //System.exit(1);\n    }\n\n    return canFill;\n  }\n\n  @SuppressWarnings(\"UnusedReturnValue\")\n  private static Map<String, Field> fillOptionsImpl(\n          Object[] instances,\n          Class<?>[] classes,\n          Properties options) {\n    return fillOptionsImpl(instances, classes, options, strict, false);","sourceCodeStart":459,"sourceCodeEnd":495,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/util/ArgumentParser.java#L459-L495","documentation":"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!\").","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add the missing property key 'fully.qualified.ClassName.optionName=value' as printed in the error","Check the class's static usage/help or @Argument(required=true) declarations for required options","Correct typos so the provided key exactly matches the declared option name","Handle the resulting RuntimeException and print available options to the user"],"exampleFix":"// before\nProperties props = new Properties(); // missing required 'file'\nArgumentParser.fillOptions(cls, props, true);\n// after\nprops.setProperty(\"edu.stanford.nlp.tagger.maxent.MaxentTagger.file\", \"model.tagger\");\nArgumentParser.fillOptions(cls, props, true);","handlingStrategy":"validation","validationCode":"// declare required options explicitly before filling\nProperties props = new Properties();\nprops.setProperty(\"my.pkg.MyClass.output\", \"out.txt\");\n// fail early if a known-required key is absent\nfor (String req : List.of(\"my.pkg.MyClass.output\")) {\n  if (!props.containsKey(req)) throw new IllegalArgumentException(\"missing required option: \" + req);\n}","typeGuard":null,"tryCatchPattern":"try {\n  ArgumentParser.fillOptions(cls, props, true);\n} catch (RuntimeException e) {\n  System.err.println(\"Check required options: \" + e.getMessage());\n  System.exit(2);\n}","preventionTips":["List required options from each class's usage text before writing configs","Match the exact dotted key printed in the error message","Validate properties files in CI with ArgumentParser in dry mode","Avoid partial copies of example configs"],"tags":["java","configuration","required-option","argument-parsing"],"backgroundTag":"missing-required-option","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}