stanfordnlp/CoreNLP · error · IllegalArgumentException

Unknown properties: " + names

Error message

Unknown properties: " + names

What it means

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).

Solutions

  1. Check the exception message for the exact unknown key names and fix or remove them from the Properties object
  2. Compare against the correct key names in the target component's documentation for your library version
  3. 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)

Example fix

// before
props.setProperty("parse.model", modelPath); // unknown key in this component
PropertiesUtils.checkProperties(props, defaults);
// after
props.setProperty("parser.model", modelPath); // correct key name
Defensive patterns

Strategy: validation

Validate before calling

Set<String> known = defaults.stringPropertyNames();
List<String> bad = props.stringPropertyNames().stream().filter(k -> !known.contains(k)).collect(Collectors.toList());
if (!bad.isEmpty()) throw new IllegalArgumentException("Unknown props: " + bad);

Try / catch

try {
  PropertiesUtils.checkProperties(props, defaults);
} catch (IllegalArgumentException e) {
  log.error("Rejecting config: " + e.getMessage());
  throw new ConfigurationException(e);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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/972aa8f2419285ed. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/util/PropertiesUtils.java:144

   * Checks to make sure that all properties specified in {@code properties}
   * are known to the program by checking that each simply overrides
   * a default value.
   *
   * @param properties Current properties
   * @param defaults Default properties which lists all known keys
   */
  @SuppressWarnings("unchecked")
  public static void checkProperties(Properties properties, Properties defaults) {
    Set<String> names = Generics.newHashSet();
    names.addAll(properties.stringPropertyNames());
    for (String defaultName : defaults.stringPropertyNames()) {
      names.remove(defaultName);
    }
    if ( ! names.isEmpty()) {
      if (names.size() == 1) {
        throw new IllegalArgumentException("Unknown property: " + names.iterator().next());
      } else {
        throw new IllegalArgumentException("Unknown properties: " + names);
      }
    }
  }

  /**
   * Build a {@code Properties} object containing key-value pairs from
   * the given data where the keys are prefixed with the given
   * {@code prefix}. The keys in the returned object will be stripped
   * of their common prefix.
   *
   * @param properties Key-value data from which to extract pairs
   * @param prefix Key-value pairs where the key has this prefix will
   *               be retained in the returned {@code Properties} object
   * @return A Properties object containing those key-value pairs from
   *         {@code properties} where the key was prefixed by
   *         {@code prefix}. This prefix is removed from all keys in
   *         the returned structure.
   */

View on GitHub (pinned to 1b7edd19c4)