{"record":{"id":"58157ebfbabc1f25","repo":"apache/druid","slug":"durationthreshold-is-not-a-valid-iso-8601-duration","errorCode":null,"errorMessage":"durationThreshold is not a valid ISO 8601 duration, got [<durationThresholdString>]","messagePattern":"durationThreshold is not a valid ISO 8601 duration, got \\[<durationThresholdString>\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/server/scheduling/WeightedQueryLaningStrategy.java","lineNumber":144,"sourceCode":"    } else {\n      try {\n        parsedPeriod = new Period(periodThresholdString);\n      }\n      catch (IllegalArgumentException e) {\n        throw new IllegalArgumentException(\n            \"periodThreshold is not a valid ISO 8601 period, got [\" + periodThresholdString + \"]\"\n        );\n      }\n    }\n    final Duration parsedDuration;\n    if (durationThresholdString == null) {\n      parsedDuration = null;\n    } else {\n      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      }","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/server/scheduling/WeightedQueryLaningStrategy.java#L126-L162","documentation":"WeightedQueryLaningStrategy parses the optional durationThreshold string as a Joda Period and converts it with toStandardDuration(). Conversion throws IllegalArgumentException for a malformed period, or UnsupportedOperationException if the period cannot be expressed as a fixed duration (e.g. containing months, whose length varies); both are rethrown as this IllegalArgumentException.","triggerScenarios":"Configuring durationThreshold with an invalid ISO 8601 duration (e.g. \"1H\", \"30min\") or a calendar-dependent period like \"P1M\" (months) that cannot convert to a standard duration.","commonSituations":"Typos in laning configs, using month/year units where only fixed-length durations (seconds/minutes/hours/days) are convertible, mixing up durationThreshold with periodThreshold semantics.","solutions":["Use a fixed-length ISO 8601 duration such as PT1M or PT30S for durationThreshold","Avoid P1M/P1Y units for this field since they cannot convert to a standard duration","Remove durationThreshold from the spec if it is not needed","Validate the config with a Period/Duration parser before applying the strategy"],"exampleFix":"// before\n{\"type\":\"sql#weighted\",\"durationThreshold\":\"P1M\"}\n// after\n{\"type\":\"sql#weighted\",\"durationThreshold\":\"PT1M\"}","handlingStrategy":"validation","validationCode":"try { new org.joda.time.Period(durationThresholdString).toStandardDuration(); } catch (IllegalArgumentException | UnsupportedOperationException e) { /* reject config */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only fixed-length durations (PT..S/M/H, P..D) for durationThreshold","Never use P1M/P1Y where a standard duration is required","Distinguish minutes (PT1M) from months (P1M) in ISO 8601 strings","Add config linting that calls toStandardDuration on all duration-like fields"],"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"}