{"record":{"id":"377246b26088311c","repo":"stanfordnlp/CoreNLP","slug":"field-is-not-in-my-list-of-fields-smallestfield","errorCode":null,"errorMessage":"Field is not in my list of fields: ${smallestFieldSet}","messagePattern":"Field is not in my list of fields: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/time/JodaTimeUtils.java","lineNumber":848,"sourceCode":"    //(special fields)\n    if(smallestFieldSet == QuarterOfYear){\n      for(int i=0; i<standardISOFields.length; i++){\n        if(standardISOFields[i] == monthOfYear()){\n          indexInStandard = i;\n        }\n      }\n    }\n    //(get data)\n    int index = -1;\n    DateTimeFieldType[] toCheck = null;\n    if(indexInStandard >= 0){\n      index = indexInStandard;\n      toCheck = standardISOFields;\n    } else if(indexInWeek >= 0){\n        index = indexInWeek;\n        toCheck = standardISOWeekFields;\n    } else {\n      throw new IllegalArgumentException(\"Field is not in my list of fields: \" + smallestFieldSet);\n    }\n    //--Perform Check\n    for(int i=index; i<toCheck.length; i++){\n      int minValue = minimumValue(toCheck[i], begin) ;\n      if(begin.get(toCheck[i]) != minValue || end.get(toCheck[i]) != minValue){\n        return false;\n      }\n    }\n    return true;\n  }\n\n  /**\n   * Return the minimum value of a field, closest to the reference time\n   */\n  public static int minimumValue(DateTimeFieldType type, ReadableDateTime reference){\n    return reference.toDateTime().property(type).getMinimumValue();\n  }\n  /**","sourceCodeStart":830,"sourceCodeEnd":866,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/time/JodaTimeUtils.java#L830-L866","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use a field type from the supported lists (year, monthOfYear, dayOfMonth, weekOfWeekyear, etc.) before invoking the check.","Map unsupported field types to the closest supported standard/ISO-week field before calling.","If you own the call site, guard with indexInStandard >= 0 || indexInWeek >= 0 and handle the unsupported case explicitly instead of relying on the exception."],"exampleFix":"// before\nboolean ok = JodaTimeUtils.checkIntervalFields(DateTimeFieldType.halfdayOfDay(), begin, end);\n// after\nDateTimeFieldType f = DateTimeFieldType.halfdayOfDay();\nif (JodaTimeUtils.indexInStandard(f) < 0 && JodaTimeUtils.indexInWeek(f) < 0) {\n  f = DateTimeFieldType.hourOfDay(); // map to a supported field\n}\nboolean ok = JodaTimeUtils.checkIntervalFields(f, begin, end);","handlingStrategy":"validation","validationCode":"// before calling the check, confirm the field is supported\nint iStd = JodaTimeUtils.indexInStandard(fieldType);\nint iWeek = JodaTimeUtils.indexInWeek(fieldType);\nif (iStd < 0 && iWeek < 0) throw new IllegalArgumentException(\"Unsupported field: \" + fieldType);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict interval checks to standard ISO and ISO-week fields","Map exotic Joda field types to supported equivalents before calling"],"tags":["joda-time","argument-validation","field-type"],"backgroundTag":"invalid-argument-value","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"}