{"id":"f86b4f8a9731e90b","repo":"go-redis/redis","slug":"redis-invalid-reply-q","errorCode":null,"errorMessage":"redis: invalid reply: %q","messagePattern":"redis: invalid reply: %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/proto/reader.go","lineNumber":333,"sourceCode":"\tb, err := r.rd.ReadSlice('\\n')\n\tif err != nil {\n\t\tif err != bufio.ErrBufferFull {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfull := make([]byte, len(b))\n\t\tcopy(full, b)\n\n\t\tb, err = r.rd.ReadBytes('\\n')\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tfull = append(full, b...) //nolint:makezero\n\t\tb = full\n\t}\n\tif len(b) <= 2 || b[len(b)-1] != '\\n' || b[len(b)-2] != '\\r' {\n\t\treturn nil, fmt.Errorf(\"redis: invalid reply: %q\", b)\n\t}\n\treturn b[:len(b)-2], nil\n}\n\nfunc (r *Reader) ReadReply() (interface{}, error) {\n\tline, err := r.ReadLine()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch line[0] {\n\tcase RespStatus:\n\t\treturn string(line[1:]), nil\n\tcase RespInt:\n\t\treturn util.ParseInt(line[1:], 10, 64)\n\tcase RespFloat:\n\t\treturn r.readFloat(line)\n\tcase RespBool:","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/internal/proto/reader.go#L315-L351","documentation":"Error \"redis: invalid reply: %q\" thrown in go-redis/redis.","triggerScenarios":"Thrown at internal/proto/reader.go:333 when the library encounters an invalid state.","commonSituations":"Log the raw offending line (already included) and reconnect on invalid replies.","solutions":["Inspect the quoted line in the error; it shows what the server sent instead of a valid reply","Ensure the command sent matches server capabilities"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}