stanfordnlp/CoreNLP · error · IllegalArgumentException
Unsupported pathtype =
Error message
Unsupported ${prefix}pathtype = ${xmlPathType} What it means
JollyDayHolidays.init() resolves the holiday XML data according to the <prefix>pathtype option, which must be one of classpath, file, or url. Any other value is rejected with an IllegalArgumentException naming the configured pathtype.
Solutions
- Set the pathtype property to exactly one of: classpath, file, or url (case-insensitive).
- Check for typos or trailing characters (e.g. 'classpath:', whitespace) in the properties value.
- Verify which prefix is used for the options object and that the property key matches '<prefix>pathtype'.
Example fix
// before
props.setProperty("holidays.pathtype", "classpath: holidays.xml");
// after
props.setProperty("holidays.pathtype", "classpath");
props.setProperty("holidays.path", "holidays.xml"); Defensive patterns
Strategy: validation
Validate before calling
String pathtype = props.getProperty(prefix + "pathtype", "").toLowerCase();
if (!pathtype.equals("classpath") && !pathtype.equals("file") && !pathtype.equals("url")) {
throw new IllegalArgumentException(prefix + "pathtype must be classpath, file, or url; got: " + pathtype);
} Prevention
- Keep pathtype values in a shared constant/enum
- Validate properties at startup before holiday initialization
When it happens
Trigger: Setting the property '<prefix>pathtype' (e.g. 'holidays.pathtype') to a value other than 'classpath', 'file', or 'url' (case-insensitive) before calling init().
Common situations: Typo like 'classpath:' or 'resourse' in the properties file; copying config from another library that uses different pathtype vocabulary; forgetting to set the property at all so it defaults to an unexpected string.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- FrenchLexer: Invalid option value in constructor: :
- Invalid feature name '
- Not a valid dashes style:
- : Invalid options key in constructor: %n
- Unknown clique: " + clique
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/887edbab1c6340b0.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/time/JollyDayHolidays.java:54
@Override
public void init(String prefix, Properties props) {
String xmlPath = props.getProperty(prefix + "xml", "edu/stanford/nlp/models/sutime/jollyday/Holidays_sutime.xml");
String xmlPathType = props.getProperty(prefix + "pathtype", "classpath");
varPrefix = props.getProperty(prefix + "prefix", varPrefix);
logger.info("Initializing JollyDayHoliday for SUTime from " + xmlPathType + ' ' + xmlPath + " as " + prefix);
Properties managerProps = new Properties();
managerProps.setProperty("manager.impl", "edu.stanford.nlp.time.JollyDayHolidays$MyXMLManager");
try {
URL holidayXmlUrl;
if (xmlPathType.equalsIgnoreCase("classpath")) {
holidayXmlUrl = getClass().getClassLoader().getResource(xmlPath);
} else if (xmlPathType.equalsIgnoreCase("file")) {
holidayXmlUrl = new URL("file:///" + xmlPath);
} else if (xmlPathType.equalsIgnoreCase("url")) {
holidayXmlUrl = new URL(xmlPath);
} else {
throw new IllegalArgumentException("Unsupported " + prefix + "pathtype = " + xmlPathType);
}
UrlManagerParameter ump = new UrlManagerParameter(holidayXmlUrl, managerProps);
holidayManager = HolidayManager.getInstance(ump);
} catch (java.net.MalformedURLException e) {
throw new RuntimeException(e);
}
if (!(holidayManager instanceof MyXMLManager)) {
throw new AssertionError("Did not get back JollyDayHolidays$MyXMLManager");
}
Configuration config = ((MyXMLManager) holidayManager).getConfiguration();
holidays = getAllHolidaysMap(config);
}
@Override
public void bind(Env env) {
if (holidays != null) {
for (Map.Entry<String, JollyHoliday> holidayEntry : holidays.entrySet()) {
JollyHoliday jh = holidayEntry.getValue();View on GitHub (pinned to 1b7edd19c4)