{"record":{"id":"75a0c149ffae7ebb","repo":"apache/druid","slug":"periodthreshold-is-not-a-valid-iso-8601-period-go","errorCode":null,"errorMessage":"periodThreshold is not a valid ISO 8601 period, got [<periodThresholdString>]","messagePattern":"periodThreshold is not a valid ISO 8601 period, got \\[<periodThresholdString>\\]","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/server/scheduling/WeightedQueryLaningStrategy.java","lineNumber":131,"sourceCode":"      @JsonProperty(\"durationThreshold\") @Nullable String durationThresholdString,\n      @JsonProperty(\"segmentCountThreshold\") @Nullable Integer segmentCountThreshold,\n      @JsonProperty(\"segmentRangeThreshold\") @Nullable String segmentRangeThresholdString,\n      @JsonProperty(\"lanes\") Map<String, LaneConfig> lanes,\n      @JsonProperty(\"periodWeight\") @Nullable Integer periodWeight,\n      @JsonProperty(\"durationWeight\") @Nullable Integer durationWeight,\n      @JsonProperty(\"segmentCountWeight\") @Nullable Integer segmentCountWeight,\n      @JsonProperty(\"segmentRangeWeight\") @Nullable Integer segmentRangeWeight\n  )\n  {\n    final Period parsedPeriod;\n    if (periodThresholdString == null) {\n      parsedPeriod = null;\n    } 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    }","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/server/scheduling/WeightedQueryLaningStrategy.java#L113-L149","documentation":"WeightedQueryLaningStrategy's constructor parses the optional periodThreshold config string as a Joda-Time Period. If the string is not a valid ISO 8601 period, it throws IllegalArgumentException with the offending value so the operator can correct the laning configuration before the strategy is used.","triggerScenarios":"Configuring maxQueryDurationOnTier/periodThreshold with a malformed value such as \"PT\", \"1-hour\", \"3600\" (bare number without unit) or other non-ISO-8601 text in the query laning strategy JSON spec.","commonSituations":"Hand-written laning specs with typos, authors confusing ISO 8601 duration format with human-readable time strings or milliseconds, using 'd'/'h' shorthand without the required P prefix.","solutions":["Use a valid ISO 8601 period such as PT1H (1 hour) or P1D (1 day)","Remove periodThreshold from the strategy spec if no period threshold is desired","Validate the string with a Joda Period parser before deploying the config","Review the strategy's JSON spec for stray whitespace or wrong fields"],"exampleFix":"// before\n{\"type\":\"sql#weighted\",\"periodThreshold\":\"1 hour\"}\n// after\n{\"type\":\"sql#weighted\",\"periodThreshold\":\"PT1H\"}","handlingStrategy":"validation","validationCode":"try { new org.joda.time.Period(periodThresholdString); } catch (IllegalArgumentException e) { /* reject config */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write ISO 8601 periods with the leading 'P' (e.g. PT1H, P1D)","Use config schema validation for query laning specs before deployment","Never put human-readable durations like \"1 hour\" in JSON configs","Unit-test laning strategy deserialization with representative configs"],"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"}