go-redis/redis · error

redis: cannot aggregate command %s: unsupported command type

Error message

redis: cannot aggregate command %s: unsupported command type %d

What it means

Error "redis: cannot aggregate command %s: unsupported command type %d" thrown in go-redis/redis.

Source

Thrown at osscluster_router.go:532

func (c *ClusterClient) readOnlyEnabled() bool {
	return c.opt.ReadOnly
}

// setCommandValue sets the aggregated value on a command using the enum-based approach
func (c *ClusterClient) setCommandValue(cmd Cmder, value interface{}) error {
	// If value is nil, it might mean ExtractCommandValue couldn't extract the value
	// but the command might have executed successfully. In this case, don't set an error.
	if value == nil {
		// ExtractCommandValue returned nil - this means the command type is not supported
		// in the aggregation flow. This is a programming error, not a runtime error.
		if cmd.Err() != nil {
			// Command already has an error, preserve it
			return cmd.Err()
		}
		// Command executed successfully but we can't extract/set the aggregated value
		// This indicates the command type needs to be added to ExtractCommandValue
		return fmt.Errorf("redis: cannot aggregate command %s: unsupported command type %d",
			cmd.Name(), cmd.GetCmdType())
	}

	switch cmd.GetCmdType() {
	case CmdTypeGeneric:
		if c, ok := cmd.(*Cmd); ok {
			c.SetVal(value)
		}
	case CmdTypeString:
		if c, ok := cmd.(*StringCmd); ok {
			if v, ok := value.(string); ok {
				c.SetVal(v)
			}
		}
	case CmdTypeInt:
		if c, ok := cmd.(*IntCmd); ok {
			if v, ok := value.(int64); ok {
				c.SetVal(v)

View on GitHub (pinned to 36d97525cd)

Solutions

  1. Do not fan out this command type across shards; run it per-shard or on a single node
  2. Use a supported aggregator for the command

When it happens

Trigger: Thrown at osscluster_router.go:532 when the library encounters an invalid state.

Common situations: Consult the routing table before issuing multi-shard variants of a command.


AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06). Data as JSON: /data/errors/30e810a3b2cf9d7e.json. Report an issue: GitHub.