stanfordnlp/CoreNLP · error · IllegalArgumentException
Cannot interpret for
Error message
Cannot interpret ${fieldValueStr} for ${fieldType} What it means
Thrown by updateTemporal when a temporal field value string (for a known datetime field type like year/month/day) cannot be parsed to an integer via parseValue. The rule tried to set or restrict a Partial-time field with a value the comparator/field parser does not understand.
Solutions
- Fix the rule regex so the captured group contains only digits, or add normalization for the captured text.
- Extend the field comparator (like month-name comparators elsewhere in the class) so textual values map to integers.
- Catch the IllegalArgumentException around updateTemporal and treat the expression as unparseable.
Example fix
// before: regex captures full month name into a numeric field Pattern: "(January|February|...)" -> field: month // after: normalize before parse or capture digits Pattern: "(0?[1-9]|1[0-2])" -> field: month
Defensive patterns
Strategy: try-catch
Validate before calling
static boolean isIntegerField(String v) { return v != null && v.matches("\\d+"); } Try / catch
try {
t = formatter.updateTemporal(t, fieldValueStr, fieldType);
} catch (IllegalArgumentException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Cannot interpret")) {
log.warn("Skipping unparseable field value: " + fieldValueStr);
return t; // keep temporal unchanged
} else throw e;
} Prevention
- Match only digit-capturing groups to numeric temporal fields.
- Normalize month names and ordinals before field binding.
- Test custom rules against sample text with edge-case captures.
When it happens
Trigger: A SUTime rule binding a regex group to a temporal field (e.g. year, month) where the captured text is non-numeric or has an unexpected shape (e.g. "March" captured for a numeric month field, "ca. 1990").
Common situations: Regexes in rule files matching looser text than the field parser expects; text like "Q1 2020" mapped to month; localized month names reaching a numeric field.
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
- 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/ed6dc1d427db76ba.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/time/TimeFormatter.java:294
}
private abstract static class DateTimeFieldComponent extends FormatComponent {
DateTimeFieldType fieldType;
public Integer parseValue(String str) { return null; }
public DateTimeFieldType getDateTimeFieldType() { return fieldType; }
public SUTime.Temporal updateTemporal(SUTime.Temporal t, String fieldValueStr) {
DateTimeFieldType dt = getDateTimeFieldType();
if (fieldValueStr != null && dt != null) {
Integer v = parseValue(fieldValueStr);
if (v != null) {
Partial pt = new Partial();
pt = JodaTimeUtils.setField(pt, dt, v);
t = t.intersect(new SUTime.PartialTime(pt));
} else {
throw new IllegalArgumentException("Cannot interpret " + fieldValueStr + " for " + fieldType);
}
}
return t;
}
}
private static class NumericDateComponent extends DateTimeFieldComponent {
private final int minValue;
private final int maxValue;
private final int minDigits;
private final int maxDigits;
public NumericDateComponent(DateTimeFieldType fieldType, int minDigits, int maxDigits) {
this.fieldType = fieldType;
this.minDigits = minDigits;View on GitHub (pinned to 1b7edd19c4)