{"record":{"id":"cc4ef1eaaeb7cc32","repo":"stanfordnlp/CoreNLP","slug":"season-start-month-is-unknown","errorCode":null,"errorMessage":"Season start month is unknown","messagePattern":"Season start month is unknown","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/time/JodaTimeUtils.java","lineNumber":978,"sourceCode":"        //(case: quarter of year)\n        value.append(\"Q\").append(( begin.getMonthOfYear()-1) / 3 + 1);\n      } else if(monthTerminal && monthDiff == 3 && begin.getMonthOfYear() % 3 == 0){\n        //(case: season)\n        switch( begin.getMonthOfYear() ){\n          case 12:\n            value.append(\"WI\");\n            break;\n          case 3:\n            value.append(\"SP\");\n            break;\n          case 6:\n            value.append(\"SU\");\n            break;\n          case 9:\n            value.append(\"FA\");\n            break;\n          default:\n            throw new IllegalStateException(\"Season start month is unknown\");\n        }\n      } else if(weekTerminal && weekDiff == 1) {\n        //(case: a week)\n        value.append(\"W\").append(zeroPad(begin.getWeekOfWeekyear(), 2));\n      } else if(monthTerminal && monthDiff == 1 && weekDiff != 1 || opts.forceDate) {\n        //(case: a month)\n        value.append( zeroPad(begin.getMonthOfYear(),2) );\n      } else {\n        //(case: treat as duration)\n        return timexDurationValue(begin, end);\n      }\n      return value.toString();\n    } else if(noFurtherFields(dayOfWeek(), begin, end) && dayDiff == 2 && begin.getDayOfWeek() == 6){\n      //(case: a weekend)\n      value.append(\"W\").append(zeroPad(begin.getWeekOfWeekyear(),2)).append(\"-WE\");\n      return value.toString();\n    } else if(dayDiff < maximumValue(dayOfMonth(),begin) || opts.forceDate) {\n      //(case: month and more)","sourceCodeStart":960,"sourceCodeEnd":996,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/time/JodaTimeUtils.java#L960-L996","documentation":"When converting a time range to a TIMEX3-style value string, a season's starting month is mapped to SU/FA etc. via a switch. If the season start month falls outside the enumerated cases (1=WInter,4=SP,6=SU,9=FA in this region), the code cannot represent it and throws an IllegalStateException.","triggerScenarios":"Calling the range-to-string formatting method (e.g. convertRangeToString / toTimexValue) on a Partial range whose computed season start month is not 1, 4, 6, or 9 — typically from inconsistent month/week fields or a buggy interval calculation in the input Partials.","commonSituations":"Unusual date ranges (e.g. spanning months that yield a season boundary of month 3 or 12) fed into SUTime range formatting; corrupted or synthetic Partial values with monthOfYear outside the expected season anchors.","solutions":["Inspect the begin Partial's monthOfYear that produced the season start; fix the interval/range computation so season anchors land on supported months.","Normalize the range before formatting (e.g. snap season starts to the nearest supported anchor month).","If new season boundaries are legitimately needed, extend the switch with additional month cases."],"exampleFix":"// before\ndefault:\n  throw new IllegalStateException(\"Season start month is unknown\");\n// after\ndefault:\n  int m = begin.getMonthOfYear();\n  if (m >= 10 || m <= 2) { value.append(\"WI\"); }\n  else { value.append(\"SP\"); }\n  break;","handlingStrategy":"try-catch","validationCode":"if (begin.get(DateTimeFieldType.monthOfYear()) != 1 && begin.get(DateTimeFieldType.monthOfYear()) != 4\n    && begin.get(DateTimeFieldType.monthOfYear()) != 6 && begin.get(DateTimeFieldType.monthOfYear()) != 9) {\n  // season anchor unsupported — normalize range first\n}","typeGuard":null,"tryCatchPattern":"try {\n  String v = JodaTimeUtils.convertRangeToString(begin, end, opts);\n} catch (IllegalStateException e) {\n  logger.warning(\"Unrepresentable season range: \" + e.getMessage());\n  // fall back to explicit date range formatting\n}","preventionTips":["Only build season ranges from SUTime's own season-resolution outputs","Sanity-check monthOfYear values on input Partials before range formatting"],"tags":["joda-time","sutime","state","temporal-annotation"],"backgroundTag":"internal-invariant-violation","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"}