{"record":{"id":"1d705cdfa198aa97","repo":"apache/druid","slug":"taskcountmin-taskcountstart-taskcountmax","errorCode":null,"errorMessage":"taskCountMin <= taskCountStart <= taskCountMax","messagePattern":"taskCountMin <= taskCountStart <= taskCountMax","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/LagBasedAutoScalerConfig.java","lineNumber":103,"sourceCode":"    this.lagCollectionIntervalMillis = lagCollectionIntervalMillis != null ? lagCollectionIntervalMillis : 30000;\n    this.lagCollectionRangeMillis = lagCollectionRangeMillis != null ? lagCollectionRangeMillis : 600000;\n    this.scaleActionStartDelayMillis = scaleActionStartDelayMillis != null ? scaleActionStartDelayMillis : 300000;\n    this.scaleActionPeriodMillis = scaleActionPeriodMillis != null ? scaleActionPeriodMillis : 60000;\n    this.scaleOutThreshold = scaleOutThreshold != null ? scaleOutThreshold : 6000000;\n    this.scaleInThreshold = scaleInThreshold != null ? scaleInThreshold : 1000000;\n    this.triggerScaleOutFractionThreshold = triggerScaleOutFractionThreshold != null ? triggerScaleOutFractionThreshold : 0.3;\n    this.triggerScaleInFractionThreshold = triggerScaleInFractionThreshold != null ? triggerScaleInFractionThreshold : 0.9;\n    this.lagAggregate = lagAggregate;\n\n    // Only do taskCountMax and taskCountMin check when autoscaler is enabled. So that users left autoConfig empty{} will not throw any exception and autoscaler is disabled.\n    // If autoscaler is disabled, no matter what configs are set, they are not used.\n    if (this.enableTaskAutoScaler) {\n      if (taskCountMax == null || taskCountMin == null) {\n        throw new RuntimeException(\"taskCountMax or taskCountMin can't be null!\");\n      } else if (taskCountMax < taskCountMin) {\n        throw new RuntimeException(\"taskCountMax can't lower than taskCountMin!\");\n      } else if (taskCountStart != null && (taskCountStart > taskCountMax || taskCountStart < taskCountMin)) {\n        throw new RuntimeException(\"taskCountMin <= taskCountStart <= taskCountMax\");\n      }\n      this.taskCountMax = taskCountMax;\n      this.taskCountMin = taskCountMin;\n      this.taskCountStart = taskCountStart;\n    }\n\n    this.scaleInStep = scaleInStep != null ? scaleInStep : 1;\n    this.scaleOutStep = scaleOutStep != null ? scaleOutStep : 2;\n    this.minTriggerScaleActionFrequencyMillis =\n        minTriggerScaleActionFrequencyMillis != null ? minTriggerScaleActionFrequencyMillis : 600000;\n    this.minScaleUpDelay = Configs.valueOrDefault(minScaleUpDelay, Duration.millis(this.minTriggerScaleActionFrequencyMillis));\n    this.minScaleDownDelay = Configs.valueOrDefault(minScaleDownDelay, Duration.millis(this.minTriggerScaleActionFrequencyMillis));\n\n    Preconditions.checkArgument(\n        stopTaskCountRatio == null || (stopTaskCountRatio > 0.0 && stopTaskCountRatio <= 1.0),\n        \"0.0 < stopTaskCountRatio <= 1.0\"\n    );\n    Preconditions.checkArgument(","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/LagBasedAutoScalerConfig.java#L85-L121","documentation":"LagBasedAutoScalerConfig also validates an optional taskCountStart: when autoscaling is enabled and taskCountStart is provided, it must lie within the [taskCountMin, taskCountMax] range. A start value outside this window makes the initial task count unreachable by the scaler, so the config throws this RuntimeException.","triggerScenarios":"Constructing LagBasedAutoScalerConfig with enableTaskAutoScaler=true, a non-null taskCountStart, and either taskCountStart > taskCountMax or taskCountStart < taskCountMin.","commonSituations":"Setting taskCountStart to the current task count after manually scaling, then changing min/max; typos in start; reusing a start value across supervisors with different ranges.","solutions":["Adjust taskCountStart so taskCountMin <= taskCountStart <= taskCountMax","Remove taskCountStart (it is optional; taskCountMin is then used as the starting count)","Widen taskCountMin/taskCountMax to include the desired start value"],"exampleFix":"// before\n\"taskCountMin\": 1,\n\"taskCountMax\": 3,\n\"taskCountStart\": 6\n// after\n\"taskCountMin\": 1,\n\"taskCountMax\": 6,\n\"taskCountStart\": 6","handlingStrategy":"validation","validationCode":"if (cfg.taskCountStart != null) {\n  if (cfg.taskCountStart > cfg.taskCountMax || cfg.taskCountStart < cfg.taskCountMin) throw new IllegalArgumentException(\"taskCountMin <= taskCountStart <= taskCountMax required\");\n}","typeGuard":null,"tryCatchPattern":"try { supervisor.start(spec); } catch (RuntimeException e) { if (e.getMessage().equals(\"taskCountMin <= taskCountStart <= taskCountMax\")) { resubmitWithClampedStart(); } else { throw e; } }","preventionTips":["Clamp taskCountStart into [min,max] programmatically before submit","Drop taskCountStart when unsure — it's optional","Re-check start after changing min/max"],"tags":["druid","config","autoscaler","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}