{"id":"b8ac36237246a461","repo":"go-redis/redis","slug":"redis-unexpected-client-info-data-s","errorCode":null,"errorMessage":"redis: unexpected client info data (%s)","messagePattern":"redis: unexpected client info data \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command.go","lineNumber":7948,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\n\t// sds o = catClientInfoString(sdsempty(), c);\n\t// o = sdscatlen(o,\"\\n\",1);\n\t// addReplyVerbatim(c,o,sdslen(o),\"txt\");\n\t// sdsfree(o);\n\tcmd.val, err = parseClientInfo(strings.TrimSpace(txt))\n\treturn err\n}\n\n// fmt.Sscanf() cannot handle null values\nfunc parseClientInfo(txt string) (info *ClientInfo, err error) {\n\tinfo = &ClientInfo{}\n\tfor _, s := range strings.Split(txt, \" \") {\n\t\tkv := strings.Split(s, \"=\")\n\t\tif len(kv) != 2 {\n\t\t\treturn nil, fmt.Errorf(\"redis: unexpected client info data (%s)\", s)\n\t\t}\n\t\tkey, val := kv[0], kv[1]\n\n\t\tswitch key {\n\t\tcase \"id\":\n\t\t\tinfo.ID, err = strconv.ParseInt(val, 10, 64)\n\t\tcase \"addr\":\n\t\t\tinfo.Addr = val\n\t\tcase \"laddr\":\n\t\t\tinfo.LAddr = val\n\t\tcase \"fd\":\n\t\t\tinfo.FD, err = strconv.ParseInt(val, 10, 64)\n\t\tcase \"name\":\n\t\t\tinfo.Name = val\n\t\tcase \"age\":\n\t\t\tvar age int\n\t\t\tif age, err = strconv.Atoi(val); err == nil {\n\t\t\t\tinfo.Age = time.Duration(age) * time.Second","sourceCodeStart":7930,"sourceCodeEnd":7966,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/command.go#L7930-L7966","documentation":"Thrown by parseClientInfo (command.go:7948) which splits the CLIENT INFO / CLIENT LIST line into space-separated `key=value` tokens. If any token does not contain exactly one '=' (e.g. a value with an embedded space, or a stray token), parsing fails. The CLIENT line is verbatim 'txt' from the server.","triggerScenarios":"Any call returning a ClientInfoCmd — client.ClientInfo(ctx), or client.ClientList(...) with a filter, or any helper that parses a CLIENT line — when a space-split token is not of the form key=value. Causes: a value containing an unescaped space (e.g. a client name with a space, or a non-standard Redis/fork adding tokens), or a corrupted/truncated line.","commonSituations":"Setting a client name containing spaces (redis.Options.ClientName or CLIENT SETNAME) which makes the 'name=' token split incorrectly; a fork that emits extra unkeyed tokens; transport truncation splitting the line.","solutions":["Avoid spaces in CLIENT SETNAME / ClientName values (use hyphens or underscores).","Inspect the raw line (`redis-cli CLIENT INFO` / `CLIENT LIST`) for tokens without '='.","Upgrade go-redis and Redis; newer servers escape spaces in client names.","If parsing a single CLIENT LIST entry, ensure you pass one client line, not the whole multi-line output."],"exampleFix":"// before: client name with a space triggers the error\nclient := redis.NewClient(&redis.Options{Addr: \":6379\", ClientName: \"my worker\"})\ninfo, err := client.ClientInfo(ctx).Result()\n// after: use a space-free name\nclient := redis.NewClient(&redis.Options{Addr: \":6379\", ClientName: \"my-worker\"})","handlingStrategy":"validation","validationCode":"// Keep client names free of spaces and equals signs.\nname := strings.NewReplacer(\" \", \"-\", \"=\", \"_\").Replace(desiredName)\nclient := redis.NewClient(&redis.Options{Addr: \":6379\", ClientName: name})","typeGuard":null,"tryCatchPattern":"info, err := client.ClientInfo(ctx).Result()\nif err != nil {\n    // CLIENT INFO is metadata; degrade to nil rather than fail the request\n    info = nil\n}","preventionTips":["Never put spaces or '=' in CLIENT SETNAME / ClientName values.","Parse one CLIENT LIST entry at a time, not the whole multi-line output.","Treat ClientInfo parsing as best-effort."],"tags":["client","client-info","parsing","config"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}