{"record":{"id":"ed6dc1d427db76ba","repo":"stanfordnlp/CoreNLP","slug":"cannot-interpret-fieldvaluestr-for-fieldtype","errorCode":null,"errorMessage":"Cannot interpret ${fieldValueStr} for ${fieldType}","messagePattern":"Cannot interpret (.+?) for (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/time/TimeFormatter.java","lineNumber":294,"sourceCode":"  }\n\n  private abstract static class DateTimeFieldComponent extends FormatComponent {\n\n    DateTimeFieldType fieldType;\n\n    public Integer parseValue(String str) { return null; }\n    public DateTimeFieldType getDateTimeFieldType() { return fieldType; }\n\n    public SUTime.Temporal updateTemporal(SUTime.Temporal t, String fieldValueStr) {\n      DateTimeFieldType dt = getDateTimeFieldType();\n      if (fieldValueStr != null && dt != null) {\n        Integer v = parseValue(fieldValueStr);\n        if (v != null) {\n          Partial pt = new Partial();\n          pt = JodaTimeUtils.setField(pt, dt, v);\n          t = t.intersect(new SUTime.PartialTime(pt));\n        } else {\n          throw new IllegalArgumentException(\"Cannot interpret \" + fieldValueStr + \" for \" + fieldType);\n        }\n      }\n      return t;\n    }\n\n  }\n\n\n  private static class NumericDateComponent extends DateTimeFieldComponent {\n\n    private final int minValue;\n    private final int maxValue;\n    private final int minDigits;\n    private final int maxDigits;\n\n    public NumericDateComponent(DateTimeFieldType fieldType, int minDigits, int maxDigits) {\n      this.fieldType = fieldType;\n      this.minDigits = minDigits;","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/time/TimeFormatter.java#L276-L312","documentation":"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.","triggerScenarios":"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\").","commonSituations":"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.","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."],"exampleFix":"// before: regex captures full month name into a numeric field\nPattern: \"(January|February|...)\"  -> field: month\n\n// after: normalize before parse or capture digits\nPattern: \"(0?[1-9]|1[0-2])\"  -> field: month","handlingStrategy":"try-catch","validationCode":"static boolean isIntegerField(String v) { return v != null && v.matches(\"\\\\d+\"); }","typeGuard":null,"tryCatchPattern":"try {\n  t = formatter.updateTemporal(t, fieldValueStr, fieldType);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Cannot interpret\")) {\n    log.warn(\"Skipping unparseable field value: \" + fieldValueStr);\n    return t; // keep temporal unchanged\n  } else throw e;\n}","preventionTips":["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."],"tags":["temporal-parsing","rule-file","illegal-argument","sutime"],"backgroundTag":"invalid-argument-format","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}