{"record":{"id":"f60d0a47bcaaa67d","repo":"stanfordnlp/CoreNLP","slug":"unknown-property-names-iterator-next","errorCode":null,"errorMessage":"Unknown property: \" + names.iterator().next()","messagePattern":"Unknown property: \" \\+ names\\.iterator\\(\\)\\.next\\(\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/util/PropertiesUtils.java","lineNumber":142,"sourceCode":"\n  /**\n   * 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","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/util/PropertiesUtils.java#L124-L160","documentation":"PropertiesUtils.checkProperties(properties, defaults) verifies that every key in 'properties' is present in the 'defaults' property set, catching typos in configuration files. Unknown keys throw IllegalArgumentException, with a singular message when exactly one unknown key remains and a plural message otherwise.","triggerScenarios":"Calling checkProperties(userProps, defaultsProps) where userProps contains at least one key not present in defaults' stringPropertyNames — typically after removing known defaults leaves a nonempty remainder.","commonSituations":"Typo in a CoreNLP properties file (e.g. 'annotator' instead of 'annotators'); using a property name from an older CoreNLP version that has since been renamed; passing pipeline options as top-level keys without the required prefix.","solutions":["Correct the property name to match a known key in defaults (check spelling)","Compare against the documentation or the defaults Properties object for valid key names","Remove the obsolete/unknown key if it is no longer supported in this CoreNLP version","Prefix component-specific options correctly (e.g. 'customAnnotator.myAnnotator.x' for custom annotators)"],"exampleFix":"// before\nprops.setProperty(\"annotater\", \"tokenize,ssplit\"); // typo\n// after\nprops.setProperty(\"annotators\", \"tokenize,ssplit\");","handlingStrategy":"validation","validationCode":"Set<String> known = defaults.stringPropertyNames();\nList<String> unknown = properties.stringPropertyNames().stream()\n    .filter(k -> !known.contains(k)).collect(Collectors.toList());\nif (!unknown.isEmpty()) System.err.println(\"Unknown property keys: \" + unknown);","typeGuard":null,"tryCatchPattern":"try {\n  PropertiesUtils.checkProperties(userProps, defaultProps);\n} catch (IllegalArgumentException e) {\n  logger.warning(\"Config check failed: \" + e.getMessage() + \" — ignoring and continuing with defaults\");\n  // or fail fast, depending on strictness\n}","preventionTips":["Keep a canonical list of valid property keys and validate config at startup","Copy key names from documentation/tests rather than typing from memory","Check the changelog for renamed properties when upgrading CoreNLP versions","Use checkProperties with the matching version's defaults so key sets stay in sync"],"tags":["properties","configuration","validation","typo","corenlp"],"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"}