stanfordnlp/CoreNLP · error · IllegalArgumentException
Cannot interpret
Error message
Cannot interpret ${fieldValueStr} What it means
Thrown by updateTemporal when none of the registered field comparators can interpret the given value string for the temporal field being updated. This is the fallback failure after all specific field parsers (year, month-name, ordinal, etc.) return null from parseValue.
Solutions
- Inspect which field the rule targets and constrain its regex to values the built-in comparators accept (digits, month names, ordinals).
- Pre-normalize captured text (strip suffixes, convert words to numbers) before binding to the field.
- Add a custom comparator to the comparator list for the new value form.
Example fix
// before
Pattern: "(the )?(early|late)? ?(\\d{4})s" -> field: year // captures "late"
// after
Pattern: "(the )?(?:early|late)? ?(\\d{4})s" -> field: year // group now only digits Defensive patterns
Strategy: try-catch
Try / catch
try {
t = formatter.updateTemporal(t, fieldValueStr);
} catch (IllegalArgumentException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Cannot interpret")) {
log.debug("Field value not recognized by any comparator: " + fieldValueStr);
return null; // treat expression as unmatched
} else throw e;
} Prevention
- Constrain rule regexes so captures correspond to known value shapes (digits, month names, ordinals).
- Add custom comparators when introducing new value forms.
- Exercise new rules with a corpus before production.
When it happens
Trigger: A rule binds captured text to a temporal field but the text matches none of the comparators — e.g. empty string, "st"/"nd" suffix alone, or mixed tokens like "late 1990s" passed as the field value.
Common situations: Over-broad regex groups in temporal rule files; normalization steps removed; user-added custom rules with fields that don't match the capture.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Cannot interpret for
- Illegal quantifier at beginning of pattern
- Invalid arguments to
- Invalid timex xml
- Unsupported formatter
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/4284ffbf7775e9bc.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/time/TimeFormatter.java:379
sb.append("\\d{").append(minDigits).append(",").append(maxDigits).append("}");
} else {
for (int i = 0; i < minDigits; i++) {
sb.append("\\d");
}
}
return sb;
}
public SUTime.Temporal updateTemporal(SUTime.Temporal t, String fieldValueStr) {
if (fieldValueStr != null) {
for (NumericDateComponent c:possibleNumericDateComponents) {
Integer v = c.parseValue(fieldValueStr);
if (v != null) {
t = c.updateTemporal(t, fieldValueStr);
return t;
}
}
throw new IllegalArgumentException("Cannot interpret " + fieldValueStr);
}
return t;
}
}
private static final Comparator<String> STRING_LENGTH_REV_COMPARATOR = (o1, o2) -> {
if (o1.length() > o2.length()) return -1;
else if (o1.length() < o2.length()) return 1;
else {
return o1.compareToIgnoreCase(o2);
}
};
private static class TextDateComponent extends DateTimeFieldComponent {
Map<String, Integer> valueMapping;
List<String> validValues;View on GitHub (pinned to 1b7edd19c4)