{"record":{"id":"972aa8f2419285ed","repo":"stanfordnlp/CoreNLP","slug":"unknown-properties-names","errorCode":null,"errorMessage":"Unknown properties: \" + names","messagePattern":"Unknown properties: \" \\+ names","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/util/PropertiesUtils.java","lineNumber":144,"sourceCode":"   * Checks to make sure that all properties specified in {@code properties}\n   * are known to the program by checking that each simply overrides\n   * a default value.\n   *\n   * @param properties Current properties\n   * @param defaults Default properties which lists all known keys\n   */\n  @SuppressWarnings(\"unchecked\")\n  public static void checkProperties(Properties properties, Properties defaults) {\n    Set<String> names = Generics.newHashSet();\n    names.addAll(properties.stringPropertyNames());\n    for (String defaultName : defaults.stringPropertyNames()) {\n      names.remove(defaultName);\n    }\n    if ( ! names.isEmpty()) {\n      if (names.size() == 1) {\n        throw new IllegalArgumentException(\"Unknown property: \" + names.iterator().next());\n      } else {\n        throw new IllegalArgumentException(\"Unknown properties: \" + names);\n      }\n    }\n  }\n\n  /**\n   * Build a {@code Properties} object containing key-value pairs from\n   * the given data where the keys are prefixed with the given\n   * {@code prefix}. The keys in the returned object will be stripped\n   * of their common prefix.\n   *\n   * @param properties Key-value data from which to extract pairs\n   * @param prefix Key-value pairs where the key has this prefix will\n   *               be retained in the returned {@code Properties} object\n   * @return A Properties object containing those key-value pairs from\n   *         {@code properties} where the key was prefixed by\n   *         {@code prefix}. This prefix is removed from all keys in\n   *         the returned structure.\n   */","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/util/PropertiesUtils.java#L126-L162","documentation":"PropertiesUtils.checkProperties validates that every key in the given Properties object is a known key listed in a defaults Properties object. After removing the recognized (and default) names, any leftover keys mean the caller passed a property the library does not understand, so it throws IllegalArgumentException, listing one key (singular message) or several (plural message).","triggerScenarios":"Calling PropertiesUtils.checkProperties(props, defaults) where props contains keys not present in the declared/defaults set; the plural message fires when two or more unknown keys remain.","commonSituations":"Typos in command-line flags or config files passed to Stanford NLP tools (e.g. 'tokenize.language' vs 'language'); renaming keys across library versions; copying options between pipeline components that accept different keys.","solutions":["Check the exception message for the exact unknown key names and fix or remove them from the Properties object","Compare against the correct key names in the target component's documentation for your library version","If running a pipeline, ensure each property is passed to the component that actually accepts it (e.g. annotator-specific props under the annotator prefix)"],"exampleFix":"// before\nprops.setProperty(\"parse.model\", modelPath); // unknown key in this component\nPropertiesUtils.checkProperties(props, defaults);\n// after\nprops.setProperty(\"parser.model\", modelPath); // correct key name","handlingStrategy":"validation","validationCode":"Set<String> known = defaults.stringPropertyNames();\nList<String> bad = props.stringPropertyNames().stream().filter(k -> !known.contains(k)).collect(Collectors.toList());\nif (!bad.isEmpty()) throw new IllegalArgumentException(\"Unknown props: \" + bad);","typeGuard":null,"tryCatchPattern":"try {\n  PropertiesUtils.checkProperties(props, defaults);\n} catch (IllegalArgumentException e) {\n  log.error(\"Rejecting config: \" + e.getMessage());\n  throw new ConfigurationException(e);\n}","preventionTips":["Keep a canonical list of valid keys per component and validate before running","Prefer loading options via the library's own argsToProperties so keys are checked early","Diff your config keys against the docs for the exact library version in use"],"tags":["java","configuration","validation","properties"],"backgroundTag":"invalid-config-value","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"}