apache/dolphinscheduler · error · java.lang.IllegalArgumentException

unSupport worker load balancer type ${type}

Error message

unSupport worker load balancer type ${type}

What it means

The master server throws this IllegalArgumentException when the configured worker load balancer type does not match any known enum constant in WorkerLoadBalancerType. randomWorkerLoadBalancer's switch statement handles FIXED_WEIGHTED_ROUND_ROBIN and DYNAMIC_WEIGHTED_ROUND_ROBIN and falls through to a default case that rejects any other value. It fails fast at startup so a misconfigured balancer is never silently used.

Source

Thrown at dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/cluster/loadbalancer/WorkerLoadBalancerConfiguration.java:45

public class WorkerLoadBalancerConfiguration {

    @Bean
    public IWorkerLoadBalancer randomWorkerLoadBalancer(MasterConfig masterConfig, ClusterManager clusterManager) {
        WorkerLoadBalancerConfigurationProperties workerLoadBalancerConfigurationProperties =
                masterConfig.getWorkerLoadBalancerConfigurationProperties();
        switch (workerLoadBalancerConfigurationProperties.getType()) {
            case RANDOM:
                return new RandomWorkerLoadBalancer(clusterManager.getWorkerClusters());
            case ROUND_ROBIN:
                return new RoundRobinWorkerLoadBalancer(clusterManager.getWorkerClusters());
            case FIXED_WEIGHTED_ROUND_ROBIN:
                return new FixedWeightedRoundRobinWorkerLoadBalancer(clusterManager.getWorkerClusters());
            case DYNAMIC_WEIGHTED_ROUND_ROBIN:
                return new DynamicWeightedRoundRobinWorkerLoadBalancer(
                        clusterManager.getWorkerClusters(),
                        workerLoadBalancerConfigurationProperties.getDynamicWeightConfigProperties());
            default:
                throw new IllegalArgumentException(
                        "unSupport worker load balancer type " + workerLoadBalancerConfigurationProperties.getType());
        }
    }

}

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Open application.yaml and set the master worker load balancer type to an exact enum constant (e.g. FIXED_WEIGHTED_ROUND_ROBIN or DYNAMIC_WEIGHTED_ROUND_ROBIN)
  2. Check spelling/casing against the WorkerLoadBalancerType enum source
  3. If migrating from an older version, map deprecated type names to the new enum constants

Example fix

// before
master:
  worker-load-balancer:
    type: round_robin
// after
master:
  worker-load-balancer:
    type: DYNAMIC_WEIGHTED_ROUND_ROBIN
Defensive patterns

Strategy: validation

Validate before calling

List<String> valid = Arrays.stream(WorkerLoadBalancerType.values()).map(Enum::name).collect(Collectors.toList());
if (!valid.contains(configuredType.toUpperCase())) {
    throw new IllegalArgumentException("type must be one of " + valid);
}

Type guard

boolean isValidBalancerType(String s) {
    return Arrays.stream(WorkerLoadBalancerType.values()).anyMatch(t -> t.name().equalsIgnoreCase(s));
}

Try / catch

try {
    WorkerLoadBalancer lb = configuration.randomWorkerLoadBalancer();
} catch (IllegalArgumentException e) {
    log.error("Bad worker load balancer type: {}", e.getMessage());
    // fall back to default DYNAMIC_WEIGHTED_ROUND_ROBIN
}

Prevention

When it happens

Trigger: Setting master worker-load-balancer type (workerLoadBalancerConfigurationProperties.getType()) to a value outside the enum, e.g. a typo like 'round-robin' or 'RANDOM', or a value from an older/newer version that the current enum no longer defines.

Common situations: YAML config typos after copying example docs, upgrading DolphinScheduler and renaming an enum constant, or programmatically setting the type with a stale string.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/1d01466d5427feaa. Report an issue: GitHub.