go-redis/redis · error

redis: unexpected option: %s

Error message

redis: unexpected option: %s

What it means

Error "redis: unexpected option: %s" thrown in go-redis/redis.

Source

Thrown at sentinel.go:524

	}

	addrs := q.strings("addr")
	for _, addr := range addrs {
		h, p, err := net.SplitHostPort(addr)
		if err != nil || h == "" || p == "" {
			return nil, fmt.Errorf("redis: unable to parse addr param: %s", addr)
		}

		o.SentinelAddrs = append(o.SentinelAddrs, net.JoinHostPort(h, p))
	}

	if o.TLSConfig != nil && q.has("skip_verify") {
		o.TLSConfig.InsecureSkipVerify = q.bool("skip_verify")
	}

	// any parameters left?
	if r := q.remaining(); len(r) > 0 {
		return nil, fmt.Errorf("redis: unexpected option: %s", strings.Join(r, ", "))
	}

	return o, nil
}

// NewFailoverClient returns a Redis client that uses Redis Sentinel
// for automatic failover. It's safe for concurrent use by multiple
// goroutines.
// Passing nil FailoverOptions will cause a panic.
func NewFailoverClient(failoverOpt *FailoverOptions) *Client {
	if failoverOpt == nil {
		panic("redis: NewFailoverClient nil options")
	}

	if failoverOpt.RouteByLatency {
		panic("to route commands by latency, use NewFailoverClusterClient")
	}
	if failoverOpt.RouteRandomly {

View on GitHub (pinned to 36d97525cd)

Solutions

  1. Remove the unsupported query parameter named in the error from the failover URL
  2. Check the supported option list in ParseURL documentation

When it happens

Trigger: Thrown at sentinel.go:524 when the library encounters an invalid state.

Common situations: Whitelist URL query parameters in config validation.


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