stanfordnlp/CoreNLP · error · IllegalArgumentException

Field is not in my list of fields

Error message

Field is not in my list of fields: ${smallestFieldSet}

What it means

This helper checks whether a field (smallestFieldSet) used to delimit a time interval is one of the library's recognized ordered field lists: standard ISO fields or ISO week fields. The field is looked up in two known lists; if it appears in neither, an IllegalArgumentException is thrown because no ordering (index) exists to run the minimum-value check from.

Solutions

  1. Use a field type from the supported lists (year, monthOfYear, dayOfMonth, weekOfWeekyear, etc.) before invoking the check.
  2. Map unsupported field types to the closest supported standard/ISO-week field before calling.
  3. If you own the call site, guard with indexInStandard >= 0 || indexInWeek >= 0 and handle the unsupported case explicitly instead of relying on the exception.

Example fix

// before
boolean ok = JodaTimeUtils.checkIntervalFields(DateTimeFieldType.halfdayOfDay(), begin, end);
// after
DateTimeFieldType f = DateTimeFieldType.halfdayOfDay();
if (JodaTimeUtils.indexInStandard(f) < 0 && JodaTimeUtils.indexInWeek(f) < 0) {
  f = DateTimeFieldType.hourOfDay(); // map to a supported field
}
boolean ok = JodaTimeUtils.checkIntervalFields(f, begin, end);
Defensive patterns

Strategy: validation

Validate before calling

// before calling the check, confirm the field is supported
int iStd = JodaTimeUtils.indexInStandard(fieldType);
int iWeek = JodaTimeUtils.indexInWeek(fieldType);
if (iStd < 0 && iWeek < 0) throw new IllegalArgumentException("Unsupported field: " + fieldType);

Prevention

When it happens

Trigger: Calling the interval/period checking method in JodaTimeUtils with a DateTimeFieldType that is not in standardISOFields or standardISOWeekFields, e.g. custom fields, DateTimeFieldType.halfdayOfDay(), clockhourOfDay(), or other fields absent from both lists.

Common situations: Passing less-common Joda field types (centuryOfEra, era, halfday) when validating interval boundaries; calling the check on Partial fields derived from user input where an unexpected field type was stored.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/377246b26088311c. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/time/JodaTimeUtils.java:848

    //(special fields)
    if(smallestFieldSet == QuarterOfYear){
      for(int i=0; i<standardISOFields.length; i++){
        if(standardISOFields[i] == monthOfYear()){
          indexInStandard = i;
        }
      }
    }
    //(get data)
    int index = -1;
    DateTimeFieldType[] toCheck = null;
    if(indexInStandard >= 0){
      index = indexInStandard;
      toCheck = standardISOFields;
    } else if(indexInWeek >= 0){
        index = indexInWeek;
        toCheck = standardISOWeekFields;
    } else {
      throw new IllegalArgumentException("Field is not in my list of fields: " + smallestFieldSet);
    }
    //--Perform Check
    for(int i=index; i<toCheck.length; i++){
      int minValue = minimumValue(toCheck[i], begin) ;
      if(begin.get(toCheck[i]) != minValue || end.get(toCheck[i]) != minValue){
        return false;
      }
    }
    return true;
  }

  /**
   * Return the minimum value of a field, closest to the reference time
   */
  public static int minimumValue(DateTimeFieldType type, ReadableDateTime reference){
    return reference.toDateTime().property(type).getMinimumValue();
  }
  /**

View on GitHub (pinned to 1b7edd19c4)