caddyserver/caddy · error
weighted_round_robin requires at least one upstream with a p
Error message
weighted_round_robin requires at least one upstream with a positive weight
What it means
Error "weighted_round_robin requires at least one upstream with a positive weight" thrown in caddyserver/caddy.
Source
Thrown at modules/caddyhttp/reverseproxy/selectionpolicies.go:133
return d.Errf("invalid weight value '%s': weight should be non-negative", weight)
}
r.Weights = append(r.Weights, weightInt)
}
return nil
}
// Provision sets up r.
func (r *WeightedRoundRobinSelection) Provision(ctx caddy.Context) error {
for _, weight := range r.Weights {
r.totalWeight += weight
}
return nil
}
// Validate ensures that r's configuration is valid
func (r *WeightedRoundRobinSelection) Validate() error {
if r.totalWeight <= 0 {
return fmt.Errorf("weighted_round_robin requires at least one upstream with a positive weight")
}
for _, weight := range r.Weights {
if weight < 0 {
return fmt.Errorf("weight of an upstream cannot be negative")
}
}
return nil
}
// Select returns an available host, if any.
func (r *WeightedRoundRobinSelection) Select(pool UpstreamPool, _ *http.Request, _ http.ResponseWriter) *Upstream {
if len(pool) == 0 {
return nil
}
if len(r.Weights) < 2 {
return pool[0]
}
var index, totalWeight intView on GitHub (pinned to 50e54ee279)
Solutions
- Give at least one upstream a positive weight in the weighted_round_robin policy.
When it happens
Trigger: Thrown at modules/caddyhttp/reverseproxy/selectionpolicies.go:133 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15).
Data as JSON: /api/errors/26fb973c0a87753f.
Report an issue: GitHub.