apache/druid · warning

No valid task counts after applying constraints for…

Error message

No valid task counts after applying constraints for supervisor[%s]

What it means

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.

Solutions

  1. Fix the supervisor autoscaler config so taskCountMin <= taskCountMax and the current task count lies within the bounds.
  2. Adjust the step/jump constraints so at least one candidate count is always admissible.
  3. Manually set the supervisor task count back into the configured range; the scaler will then operate normally.

Example fix

// before (overlord console supervisor spec)
"autoscaler": {"type":"cost","taskCountMin":5,"taskCountMax":3}
// after
"autoscaler": {"type":"cost","taskCountMin":1,"taskCountMax":5}
Defensive patterns

Strategy: validation

Validate before calling

AutoScalerConfig c = supervisorSpec.getAutoScalerConfig();
if (c != null && c.getTaskCountMin() > c.getTaskCountMax()) {
  throw new IllegalArgumentException("taskCountMin must be <= taskCountMax");
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/6765bdd6ceb872f1. Report an issue: GitHub.

Appendix: source

Thrown at indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/supervisor/autoscaler/CostBasedAutoScaler.java:266

      );
      return CANNOT_COMPUTE;
    }

    final int partitionCount = metrics.getPartitionCount();
    final int currentTaskCount = metrics.getCurrentTaskCount();
    if (partitionCount <= 0 || currentTaskCount <= 0) {
      return CANNOT_COMPUTE;
    }

    final int[] validTaskCounts = CostBasedAutoScaler.computeValidTaskCounts(
        partitionCount,
        config.getTaskCountMin(),
        config.getTaskCountMax()
    );

    if (validTaskCounts.length == 0) {
      // Return current count (not an error) so the supervisor can clamp it back into bounds.
      log.warn("No valid task counts after applying constraints for supervisor[%s]", supervisorId);
      return currentTaskCount;
    }

    final boolean highLag = isHighLag(metrics);
    final boolean criticalLag = isCriticalLag(metrics);
    if (criticalLag) {
      log.info(
          "Supervisor[%s] aggregateLag[%.0f] crossed [%.0f%%] of criticalLagThreshold[%d]: skipping the argmin"
          + " search and jumping straight to the maximum task count.",
          supervisorId, metrics.getAggregateLag(), WeightedCostFunction.CRITICAL_LAG_THRESHOLD_FRACTION * 100,
          config.getCriticalLagThreshold()
      );
    } else if (highLag) {
      log.info(
          "Supervisor[%s] aggregateLag[%.0f] crossed [%.0f%%] of criticalLagThreshold[%d]: widening scale-up"
          + " candidates and maxing out the high-lag cost factor.",
          supervisorId, metrics.getAggregateLag(), WeightedCostFunction.HIGH_LAG_THRESHOLD_FRACTION * 100,
          config.getCriticalLagThreshold()

View on GitHub (pinned to 9b90983fd2)