{"record":{"id":"549579e5c3d68cab","repo":"apache/druid","slug":"segmentrangethreshold-is-not-a-valid-iso-8601-dura","errorCode":null,"errorMessage":"segmentRangeThreshold is not a valid ISO 8601 duration, got [<segmentRangeThresholdString>]","messagePattern":"segmentRangeThreshold is not a valid ISO 8601 duration, got \\[<segmentRangeThresholdString>\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/server/scheduling/WeightedQueryLaningStrategy.java","lineNumber":158,"sourceCode":"      try {\n        parsedDuration = new Period(durationThresholdString).toStandardDuration();\n      }\n      catch (IllegalArgumentException | UnsupportedOperationException e) {\n        throw new IllegalArgumentException(\n            \"durationThreshold is not a valid ISO 8601 duration, \"\n            + \"got [\" + durationThresholdString + \"]\"\n        );\n      }\n    }\n    final Duration parsedSegmentRange;\n    if (segmentRangeThresholdString == null) {\n      parsedSegmentRange = null;\n    } else {\n      try {\n        parsedSegmentRange = new Period(segmentRangeThresholdString).toStandardDuration();\n      }\n      catch (IllegalArgumentException | UnsupportedOperationException e) {\n        throw new IllegalArgumentException(\n            \"segmentRangeThreshold is not a valid ISO 8601 duration, \"\n            + \"got [\" + segmentRangeThresholdString + \"]\"\n        );\n      }\n    }\n\n    Preconditions.checkArgument(\n        segmentCountThreshold != null || parsedPeriod != null || parsedDuration != null || parsedSegmentRange != null,\n        \"At least one of periodThreshold, durationThreshold, segmentCountThreshold, or segmentRangeThreshold must be set\"\n    );\n    Preconditions.checkArgument(\n        segmentCountThreshold == null || segmentCountThreshold > 0,\n        \"segmentCountThreshold must be > 0, got [%s]\", segmentCountThreshold\n    );\n    if (parsedDuration != null) {\n      Preconditions.checkArgument(parsedDuration.getMillis() > 0, \"durationThreshold must be positive, got [%s]\", durationThresholdString);\n    }\n    if (parsedSegmentRange != null) {","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/server/scheduling/WeightedQueryLaningStrategy.java#L140-L176","documentation":"WeightedQueryLaningStrategy parses the optional segmentRangeThreshold string as a Joda Period and converts it via toStandardDuration(). A malformed ISO 8601 period (IllegalArgumentException) or a non-fixed-length period such as months (UnsupportedOperationException) causes this IllegalArgumentException naming the offending value.","triggerScenarios":"Configuring segmentRangeThreshold with invalid syntax (e.g. \"5M\" intending five minutes instead of five months, or \"five minutes\") or calendar-dependent units that cannot become a standard duration.","commonSituations":"Confusing M (months) with PT..M (minutes) in ISO 8601 strings, hand-edited cluster configs, copying thresholds between fields with different format expectations.","solutions":["Use an explicit fixed-length ISO 8601 duration, e.g. PT5M for five minutes (note the T separating time parts)","Avoid months/years in segmentRangeThreshold; use days or smaller units","Remove segmentRangeThreshold if the default behavior is acceptable","Lint the laning strategy JSON against the Druid configuration schema before deploy"],"exampleFix":"// before\n{\"type\":\"sql#weighted\",\"segmentRangeThreshold\":\"5M\"}\n// after\n{\"type\":\"sql#weighted\",\"segmentRangeThreshold\":\"PT5M\"}","handlingStrategy":"validation","validationCode":"try { new org.joda.time.Period(segmentRangeThresholdString).toStandardDuration(); } catch (IllegalArgumentException | UnsupportedOperationException e) { /* reject config */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write minutes as PT5M, months as P5M — check the T carefully","Prefer seconds/minutes/hours units for segment range thresholds","Lint all laning strategy durations with toStandardDuration before deploy","Keep a shared config template with correctly formatted durations"],"tags":["config","iso8601"],"backgroundTag":"invalid-duration-format","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}