{"record":{"id":"12c0452e20f9ade6","repo":"redis/go-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":7954,"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":7936,"sourceCodeEnd":7972,"githubUrl":"https://github.com/redis/go-redis/blob/c5cad058c72f58370553b48566302303cf8a2e89/command.go#L7936-L7972","documentation":"CLIENT INFO returns a space-separated list of key=value pairs describing the connection. parseClientInfo splits each token on '=' and requires exactly two parts; any malformed token (extra '=', spaces inside values, null placeholder, or empty token) causes this error. The comment in the source notes fmt.Sscanf cannot handle null values, hence the hand-rolled parser.","triggerScenarios":"Calling ClientInfo() (or echoing CLIENT INFO via conn) when the reply contains a token that is not a clean key=value pair — e.g. 'name=' with empty value, 'db=0 extra', or a null/empty segment.","commonSituations":"Connections with a client name containing spaces or '=' set via CLIENT SETNAME; proxies injecting attributes into CLIENT INFO; odd server builds emitting empty fields.","solutions":["Set the connection name with characters free of spaces and '=' (CLIENT SETNAME / Options.ClientName).","Print the raw CLIENT INFO (redis-cli CLIENT INFO) to find the offending token.","Upgrade go-redis; newer parsers tolerate more edge cases in CLIENT INFO.","If a proxy or module injects the bad field, fix or bypass it."],"exampleFix":"// before: client name with spaces breaks parsing\nrdb := redis.NewClient(&redis.Options{ClientName: \"my app=v2\"})\ninfo, err := rdb.ClientInfo(ctx) // redis: unexpected client info data (app=v2)\n\n// after: sanitize the name\nrdb := redis.NewClient(&redis.Options{ClientName: \"my-app-v2\"})\ninfo, err := rdb.ClientInfo(ctx)","handlingStrategy":"validation","validationCode":"name := rdb.Options().ClientName\nif strings.ContainsAny(name, \" =\") {\n    // sanitize before connecting / calling CLIENT INFO\n    name = strings.Map(func(r rune) rune {\n        if r == ' ' || r == '=' { return '-' }\n        return r\n    }, name)\n}","typeGuard":null,"tryCatchPattern":"info, err := rdb.ClientInfo(ctx)\nif err != nil {\n    if strings.Contains(err.Error(), \"unexpected client info data\") {\n        // fall back to raw CLIENT INFO string and parse defensively\n    }\n    return err\n}","preventionTips":["Keep ClientName free of spaces and '=' characters","Log the raw CLIENT INFO when this error occurs to find the bad token","Avoid proxies/modules that inject extra CLIENT INFO fields","Keep go-redis updated for parser fixes"],"tags":["redis","client-info","parsing"],"backgroundTag":"malformed-server-reply","analyzedSha":"c5cad058c72f58370553b48566302303cf8a2e89","analyzedAt":"2026-09-01T06:50:53.388Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}