apache/druid · error · IllegalArgumentException
durationThreshold is not a valid ISO 8601 duration, got
Error message
durationThreshold is not a valid ISO 8601 duration, got [<durationThresholdString>]
What it means
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.
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
Example fix
// before
{"type":"sql#weighted","durationThreshold":"P1M"}
// after
{"type":"sql#weighted","durationThreshold":"PT1M"} Defensive patterns
Strategy: validation
Validate before calling
try { new org.joda.time.Period(durationThresholdString).toStandardDuration(); } catch (IllegalArgumentException | UnsupportedOperationException e) { /* reject config */ } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "invalid duration" / "failed to parse duration": why your timeout, interval, or TTL string is rejected and which formats each library accepts — this error's family across 32 libraries.
Related errors
- periodThreshold is not a valid ISO 8601 period, got
- segmentRangeThreshold is not a valid ISO 8601 duration, got
- At least one of baseDir or files should be specified
- bucketSize must be a power of two (from 1 up to 128) but…
- Cannot delete all segment files since Azure Deep Storage…
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/58157ebfbabc1f25.
Report an issue: GitHub.
Appendix: source
Thrown at server/src/main/java/org/apache/druid/server/scheduling/WeightedQueryLaningStrategy.java:144
} else {
try {
parsedPeriod = new Period(periodThresholdString);
}
catch (IllegalArgumentException e) {
throw new IllegalArgumentException(
"periodThreshold is not a valid ISO 8601 period, got [" + periodThresholdString + "]"
);
}
}
final Duration parsedDuration;
if (durationThresholdString == null) {
parsedDuration = null;
} else {
try {
parsedDuration = new Period(durationThresholdString).toStandardDuration();
}
catch (IllegalArgumentException | UnsupportedOperationException e) {
throw new IllegalArgumentException(
"durationThreshold is not a valid ISO 8601 duration, "
+ "got [" + durationThresholdString + "]"
);
}
}
final Duration parsedSegmentRange;
if (segmentRangeThresholdString == null) {
parsedSegmentRange = null;
} else {
try {
parsedSegmentRange = new Period(segmentRangeThresholdString).toStandardDuration();
}
catch (IllegalArgumentException | UnsupportedOperationException e) {
throw new IllegalArgumentException(
"segmentRangeThreshold is not a valid ISO 8601 duration, "
+ "got [" + segmentRangeThresholdString + "]"
);
}View on GitHub (pinned to 9b90983fd2)