apache/druid · error · IllegalArgumentException
maxTries must be greater than 1
Error message
maxTries must be greater than 1
What it means
RetryingInputStream validates its retry policy in the constructor and requires maxTries to be greater than 1, since with a single try there is no point in the retry wrapper. Values of 0, 1, or negative throw this IllegalArgumentException.
Solutions
- Set maxTries to at least 2 (Druid's default is RetryUtils.DEFAULT_MAX_TRIES)
- Leave maxTries null to use the default instead of setting 1
- Fix ingestion spec fields like http.maxRetry to a valid value >= 2
Example fix
// before new RetryingInputStream(openFn, retryCond, 1, doWait); // after new RetryingInputStream(openFn, retryCond, 3, doWait);
Defensive patterns
Strategy: validation
Validate before calling
if (maxTries != null && maxTries <= 1) { throw new IllegalArgumentException("maxTries must be > 1"); } Prevention
- Leave maxTries null to use the default
- Never configure retry counts of 0 or 1 for RetryingInputStream
- Validate spec numeric fields against minimums before submission
When it happens
Trigger: Constructing RetryingInputStream with maxTries <= 1 (e.g. 0, 1, or negative), often from deserialized inputFormat/split specs where maxRetry or httpMaxRetry was set to 1 or 0.
Common situations: Config authors setting maxRetry: 1 intending 'one attempt', property files with 0 or unset-then-defaulted values, programmatic builders passing Integer constants like 1.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- At least one of baseDir or files should be specified
- bucketSize must be a power of two (from 1 up to 128) but…
- Cannot have a null/empty columns
- Cannot set kafka property [auto.offset.reset]. Property…
- Cannot set kafka property [enable.auto.commit]. Property…
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/86ba415f8498f9f2.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/data/input/impl/RetryingInputStream.java:92
}
@VisibleForTesting
RetryingInputStream(
T object,
ObjectOpenFunction<T> objectOpenFunction,
Predicate<Throwable> retryCondition,
@Nullable Integer maxTries,
boolean doWait
) throws IOException
{
this.object = Preconditions.checkNotNull(object, "object");
this.objectOpenFunction = Preconditions.checkNotNull(objectOpenFunction, "objectOpenFunction");
this.retryCondition = Preconditions.checkNotNull(retryCondition, "retryCondition");
this.maxTries = maxTries == null ? RetryUtils.DEFAULT_MAX_TRIES : maxTries;
this.doWait = doWait;
if (this.maxTries <= 1) {
throw new IAE("maxTries must be greater than 1");
}
openWithRetry(0);
}
private void openIfNeeded() throws IOException
{
if (delegate == null) {
openWithRetry(startOffset);
}
}
private void openWithRetry(final long offset) throws IOException
{
for (int nTry = 0; nTry < maxTries; nTry++) {
try {
delegate = new CountingInputStream(objectOpenFunction.open(object, offset));
break;
}View on GitHub (pinned to 9b90983fd2)