stanfordnlp/CoreNLP · error · IllegalArgumentException
Unknown property: " + names.iterator().next()
Error message
Unknown property: " + names.iterator().next()
What it means
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.
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)
Example fix
// before
props.setProperty("annotater", "tokenize,ssplit"); // typo
// after
props.setProperty("annotators", "tokenize,ssplit"); Defensive patterns
Strategy: validation
Validate before calling
Set<String> known = defaults.stringPropertyNames();
List<String> unknown = properties.stringPropertyNames().stream()
.filter(k -> !known.contains(k)).collect(Collectors.toList());
if (!unknown.isEmpty()) System.err.println("Unknown property keys: " + unknown); Try / catch
try {
PropertiesUtils.checkProperties(userProps, defaultProps);
} catch (IllegalArgumentException e) {
logger.warning("Config check failed: " + e.getMessage() + " — ignoring and continuing with defaults");
// or fail fast, depending on strictness
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
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
- Unknown properties: " + names
- annotator " " requires annotation " ". The usual…
- Both parse.model and parse.executable properties must be…
- Cannot determine annotation key for
- Cannot have these two ordering constraints
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/f60d0a47bcaaa67d.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/util/PropertiesUtils.java:142
/**
* 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 inView on GitHub (pinned to 1b7edd19c4)