{"record":{"id":"a21ee54e8915f766","repo":"redis/go-redis","slug":"redis-unexpected-option-s-a21ee5","errorCode":null,"errorMessage":"redis: unexpected option: %s","messagePattern":"redis: unexpected option: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sentinel.go","lineNumber":533,"sourceCode":"\t}\n\n\taddrs := q.strings(\"addr\")\n\tfor _, addr := range addrs {\n\t\th, p, err := net.SplitHostPort(addr)\n\t\tif err != nil || h == \"\" || p == \"\" {\n\t\t\treturn nil, fmt.Errorf(\"redis: unable to parse addr param: %s\", addr)\n\t\t}\n\n\t\to.SentinelAddrs = append(o.SentinelAddrs, net.JoinHostPort(h, p))\n\t}\n\n\tif o.TLSConfig != nil && q.has(\"skip_verify\") {\n\t\to.TLSConfig.InsecureSkipVerify = q.bool(\"skip_verify\")\n\t}\n\n\t// any parameters left?\n\tif r := q.remaining(); len(r) > 0 {\n\t\treturn nil, fmt.Errorf(\"redis: unexpected option: %s\", strings.Join(r, \", \"))\n\t}\n\n\treturn o, nil\n}\n\n// NewFailoverClient returns a Redis client that uses Redis Sentinel\n// for automatic failover. It's safe for concurrent use by multiple\n// goroutines.\n// Passing nil FailoverOptions will cause a panic.\nfunc NewFailoverClient(failoverOpt *FailoverOptions) *Client {\n\tif failoverOpt == nil {\n\t\tpanic(\"redis: NewFailoverClient nil options\")\n\t}\n\n\tif failoverOpt.RouteByLatency {\n\t\tpanic(\"to route commands by latency, use NewFailoverClusterClient\")\n\t}\n\tif failoverOpt.RouteRandomly {","sourceCodeStart":515,"sourceCodeEnd":551,"githubUrl":"https://github.com/redis/go-redis/blob/c5cad058c72f58370553b48566302303cf8a2e89/sentinel.go#L515-L551","documentation":"After parsing all supported failover-URL query parameters (mastername, db, addr, skip_verify), any leftover parameters are rejected by setupFailoverConnParams with this error listing the unknown names. This catches typos and unsupported options early instead of silently ignoring them.","triggerScenarios":"ParseFailoverURL with unknown or misspelled query params, e.g. ?addr=...&master=mymaster (supported name is mastername) or ?password=secret (not supported on failover URLs).","commonSituations":"Reusing query params from regular redis:// URL docs that don't apply to the failover parser, typos like addrs= or tls=, and params added by secret-injection tooling.","solutions":["Remove the unknown parameters from the URL","Check accepted names: use mastername (not master) and db, addr, skip_verify","Set options that aren't URL-supported directly on the returned FailoverOptions struct after parsing"],"exampleFix":"// before\n\"redis://mymaster?addr=s1:26379&master=mymaster\"   // wrong param name\n// after\n\"redis://mymaster?addr=s1:26379&mastername=mymaster\"","handlingStrategy":"validation","validationCode":"allowed := map[string]bool{\"mastername\": true, \"db\": true, \"addr\": true, \"skip_verify\": true}\nu, err := url.Parse(raw)\nif err != nil { return err }\nfor k := range u.Query() {\n    if !allowed[k] { return fmt.Errorf(\"unsupported failover URL param %q\", k) }\n}","typeGuard":null,"tryCatchPattern":"opt, err := redis.ParseFailoverURL(raw)\nif err != nil {\n    if strings.Contains(err.Error(), \"unexpected option\") { /* strip or rename params */ }\n    return err\n}","preventionTips":["Consult the failover URL docs for the accepted parameter names before hand-writing URLs","Prefer building FailoverOptions in code over long URLs","Add a unit test parsing each connection-string variant you ship"],"tags":["redis","sentinel","url-parsing","query-params"],"backgroundTag":"unexpected-query-parameter","analyzedSha":"c5cad058c72f58370553b48566302303cf8a2e89","analyzedAt":"2026-09-01T06:50:53.388Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}