stanfordnlp/CoreNLP · error · RuntimeException
unknown value " " in
Error message
unknown value "%s" in %s
What it means
Terminal fallthrough of Timex.getRange: if the val matched none of the recognized forms (dates, PnY/PnM/PnD durations, seasons, quarters, empty-set, etc.), the method throws RuntimeException with the unrecognized val. It signals a value format the range expander does not understand.
Solutions
- Convert week durations (PnW) to days (PnD) before building/using the Timex
- Normalize compound durations into the supported PnY/PnM/PnD forms
- Catch RuntimeException, log the val, and return null or an empty range
- Extend getRange with an additional Pattern case for the unsupported format
Example fix
// before
Pair<Calendar,Calendar> range = timex.getRange(documentTime);
// after
String v = timex.val();
if (v != null && v.matches("P\\d+W")) {
timex = new Timex(v.replaceFirst("(P\\d+)W", "$1") /* convert weeks to days: P1W -> P7D */);
}
Pair<Calendar,Calendar> range = timex.getRange(documentTime); Defensive patterns
Strategy: try-catch
Validate before calling
Set<String> supported = Pattern: date8, P\\d+[YMD], \\d+SP, quarter/season codes — pre-check val against these;
Try / catch
try { range = timex.getRange(docTime); } catch (RuntimeException e) { log.warn("unhandled Timex val: " + timex.val()); range = null; } Prevention
- Normalize ISO 8601 durations (weeks, compound forms) to PnY/PnM/PnD before building Timex
- Keep a whitelist of supported val shapes in your pipeline
- Always pass a non-null documentTime to avoid both NPE and fallthrough
When it happens
Trigger: Calling getRange() on vals like 'P1W' (weeks are not handled), 'P1YT2H', '20090602T1200' style oddities, or other unnormalized strings that reach the end of the method.
Common situations: TimeML corpora containing ISO 8601 week durations (PnW) or compound durations that this implementation does not expand; feeding raw ISO 8601 strings into Timex.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- begin and end are equal
- begin and end are equal
- Failed to process timex
- no value specified for
- is not a fully specified date
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/e4f957c074fbe32c.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/time/Timex.java:564
if (Pattern.matches("\\d\\d\\d\\dW\\d+", this.val)) {
int year = Integer.parseInt(this.val.substring(0, 4));
int week = Integer.parseInt(this.val.substring(5));
int startDay = (week - 1) * 7;
int endDay = startDay + 6;
Calendar start = makeCalendar(year, startDay);
Calendar end = makeCalendar(year, endDay);
return new Pair<>(start, end);
}
// PRESENT_REF
if (this.val.equals("PRESENT_REF")) {
Calendar rc = documentTime.getDate(); // todo: This case doesn't check for documentTime being null and will NPE
Calendar start = copyCalendar(rc);
Calendar end = copyCalendar(rc);
return new Pair<>(start, end);
}
throw new RuntimeException(String.format("unknown value \"%s\" in %s", this.val, this));
}
private static Calendar makeCalendar(int year, int month, int day) {
Calendar date = Calendar.getInstance();
date.clear();
date.set(year, month - 1, day, 0, 0, 0);
return date;
}
private static Calendar makeCalendar(int year, int dayOfYear) {
Calendar date = Calendar.getInstance();
date.clear();
date.set(Calendar.YEAR, year);
date.set(Calendar.DAY_OF_YEAR, dayOfYear);
return date;
}
private static Calendar copyCalendar(Calendar c) {View on GitHub (pinned to 1b7edd19c4)