go-redis/redis · error
redis: no valid results to aggregate for logical OR operatio
Error message
redis: no valid results to aggregate for logical OR operation
What it means
routing.ErrOrAggregation is returned by AggLogicalOrAggregator.Result() when no shard contributed a boolean result (aggregator.go:626-628). The OR aggregator only has a value once at least one Add stored a boolean; if all shards errored or none were added, hasResult is false and Result fails.
Source
Thrown at internal/routing/aggregator.go:19
package routing
import (
"errors"
"fmt"
"math"
"sync"
"sync/atomic"
"github.com/redis/go-redis/v9/internal/util"
uberAtomic "go.uber.org/atomic"
)
var (
ErrMaxAggregation = errors.New("redis: no valid results to aggregate for max operation")
ErrMinAggregation = errors.New("redis: no valid results to aggregate for min operation")
ErrAndAggregation = errors.New("redis: no valid results to aggregate for logical AND operation")
ErrOrAggregation = errors.New("redis: no valid results to aggregate for logical OR operation")
)
// ResponseAggregator defines the interface for aggregating responses from multiple shards.
type ResponseAggregator interface {
// Add processes a single shard response.
Add(result interface{}, err error) error
// AddWithKey processes a single shard response for a specific key (used by keyed aggregators).
AddWithKey(key string, result interface{}, err error) error
BatchAdd(map[string]AggregatorResErr) error
BatchSlice([]AggregatorResErr) error
// Result returns the final aggregated result and any error.
Result() (interface{}, error)
}
View on GitHub (pinned to 36d97525cd)
Solutions
- Check per-shard errors to locate the failing node(s).
- Verify the response policy (agg_logical_or) fits the command's boolean output.
- Handle the empty-aggregation case explicitly (e.g. default false).
Example fix
// before
res, err := clusterClient.BoolOrCmd(ctx)
// after
res, err := clusterClient.BoolOrCmd(ctx)
if errors.Is(err, routing.ErrOrAggregation) {
return false, nil
} Defensive patterns
Strategy: try-catch
Validate before calling
// No app-level pre-check; ensure all shards healthy and command returns booleans.
Try / catch
res, err := clusterClient.BoolOrCmd(ctx)
if errors.Is(err, routing.ErrOrAggregation) {
return false, nil
} Prevention
- Maintain cluster shard availability for complete fan-outs.
- Match the command to agg_logical_or only when output is boolean.
- Handle the no-results case explicitly.
When it happens
Trigger: A ClusterClient command using RespAggLogicalOr where every shard errored or none returned a boolean, leaving the OR with no operands.
Common situations: Cluster node failures during fan-out, command mis-mapped to agg_logical_or, or all shards returning errors.
Related errors
- redis: no valid results to aggregate for max operation
- redis: no valid results to aggregate for logical AND operati
- redis: cluster has no nodes
- redis: cannot pipeline command %q with request policy ReqAll
- redis: multi-shard command %s has no key arguments
AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06).
Data as JSON: /data/errors/2e4ac1bae0ab87c4.json.
Report an issue: GitHub.