go-redis/redis · error

redis: CLIENT TRACKING PREFIX requires BCAST

Error message

redis: CLIENT TRACKING PREFIX requires BCAST

What it means

Error "redis: CLIENT TRACKING PREFIX requires BCAST" thrown in go-redis/redis.

Solutions

  1. Enable BCAST when supplying PREFIX prefixes for CLIENT TRACKING
  2. Drop the PREFIX arguments if BCAST mode is not desired

When it happens

Trigger: Thrown at commands.go:634 when the library encounters an invalid state.

Common situations: Pair PREFIX options with BCAST in a single constructor so the dependency cannot be broken.


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

Appendix: source

Thrown at commands.go:634

}

// ClientTrackingOff disables tracking on the serving connection. See
// ClientTracking for the pooled-client and built-in-CSC caveats.
func (c cmdable) ClientTrackingOff(ctx context.Context) *StatusCmd {
	cmd := NewStatusCmd(ctx, "client", "tracking", "off")
	_ = c(ctx, cmd)
	return cmd
}

func validateClientTrackingOptions(opt *ClientTrackingOptions) error {
	if opt.OptIn && opt.OptOut {
		return errors.New("redis: CLIENT TRACKING OPTIN and OPTOUT are mutually exclusive")
	}
	if opt.Bcast && (opt.OptIn || opt.OptOut) {
		return errors.New("redis: CLIENT TRACKING BCAST cannot be combined with OPTIN or OPTOUT")
	}
	if len(opt.Prefixes) > 0 && !opt.Bcast {
		return errors.New("redis: CLIENT TRACKING PREFIX requires BCAST")
	}
	return nil
}

func appendClientTrackingOptions(args []interface{}, opt *ClientTrackingOptions) []interface{} {
	if opt.Redirect != 0 {
		args = append(args, "redirect", opt.Redirect)
	}
	if opt.Bcast {
		args = append(args, "bcast")
	}
	for _, p := range opt.Prefixes {
		args = append(args, "prefix", p)
	}
	if opt.OptIn {
		args = append(args, "optin")
	}
	if opt.OptOut {

View on GitHub (pinned to 36d97525cd)