{"record":{"id":"6765bdd6ceb872f1","repo":"apache/druid","slug":"no-valid-task-counts-after-applying-constraints-fo","errorCode":null,"errorMessage":"No valid task counts after applying constraints for supervisor[%s]","messagePattern":"No valid task counts after applying constraints for supervisor\\[(.+?)\\]","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/CostBasedAutoScaler.java","lineNumber":266,"sourceCode":"      );\n      return CANNOT_COMPUTE;\n    }\n\n    final int partitionCount = metrics.getPartitionCount();\n    final int currentTaskCount = metrics.getCurrentTaskCount();\n    if (partitionCount <= 0 || currentTaskCount <= 0) {\n      return CANNOT_COMPUTE;\n    }\n\n    final int[] validTaskCounts = CostBasedAutoScaler.computeValidTaskCounts(\n        partitionCount,\n        config.getTaskCountMin(),\n        config.getTaskCountMax()\n    );\n\n    if (validTaskCounts.length == 0) {\n      // Return current count (not an error) so the supervisor can clamp it back into bounds.\n      log.warn(\"No valid task counts after applying constraints for supervisor[%s]\", supervisorId);\n      return currentTaskCount;\n    }\n\n    final boolean highLag = isHighLag(metrics);\n    final boolean criticalLag = isCriticalLag(metrics);\n    if (criticalLag) {\n      log.info(\n          \"Supervisor[%s] aggregateLag[%.0f] crossed [%.0f%%] of criticalLagThreshold[%d]: skipping the argmin\"\n          + \" search and jumping straight to the maximum task count.\",\n          supervisorId, metrics.getAggregateLag(), WeightedCostFunction.CRITICAL_LAG_THRESHOLD_FRACTION * 100,\n          config.getCriticalLagThreshold()\n      );\n    } else if (highLag) {\n      log.info(\n          \"Supervisor[%s] aggregateLag[%.0f] crossed [%.0f%%] of criticalLagThreshold[%d]: widening scale-up\"\n          + \" candidates and maxing out the high-lag cost factor.\",\n          supervisorId, metrics.getAggregateLag(), WeightedCostFunction.HIGH_LAG_THRESHOLD_FRACTION * 100,\n          config.getCriticalLagThreshold()","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/CostBasedAutoScaler.java#L248-L284","documentation":"CostBasedAutoScaler.computeOptimalTaskCount filters allowed task counts by supervisor min/max constraints and other bounds. If the resulting array is empty (constraints admit no candidate count), it logs a warning and returns the current task count so the supervisor can clamp it back into valid bounds. It is deliberately non-fatal: no scale action is taken.","triggerScenarios":"Applying autoscaler constraints (taskCountMin, taskCountMax, allowed step sizes/jump limits) yields zero valid candidate counts, e.g. when current task count and min/max configuration leave no permissible value in the candidate set.","commonSituations":"Misconfigured supervisor autoscaler where taskCountMin > taskCountMax, or lag thresholds and step limits combined with a current count outside [min, max] produce an empty candidate set.","solutions":["Fix the supervisor autoscaler config so taskCountMin <= taskCountMax and the current task count lies within the bounds.","Adjust the step/jump constraints so at least one candidate count is always admissible.","Manually set the supervisor task count back into the configured range; the scaler will then operate normally."],"exampleFix":"// before (overlord console supervisor spec)\n\"autoscaler\": {\"type\":\"cost\",\"taskCountMin\":5,\"taskCountMax\":3}\n// after\n\"autoscaler\": {\"type\":\"cost\",\"taskCountMin\":1,\"taskCountMax\":5}","handlingStrategy":"validation","validationCode":"AutoScalerConfig c = supervisorSpec.getAutoScalerConfig();\nif (c != null && c.getTaskCountMin() > c.getTaskCountMax()) {\n  throw new IllegalArgumentException(\"taskCountMin must be <= taskCountMax\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always configure taskCountMin <= taskCountMax in the autoscaler block.","Keep the supervisor's current taskCount within [min, max].","Avoid step/jump constraints that can exclude every candidate count."],"tags":["druid","autoscaling","kafka","supervisor","configuration"],"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-17T15:17:12.973Z"}