{"id":"e3b06f8cadfea82b","repo":"go-redis/redis","slug":"redis-got-d-elements-commands-reply-in-slowlog-g","errorCode":null,"errorMessage":"redis: got %d elements commands reply in slowlog get, expected at least 1","messagePattern":"redis: got (.+?) elements commands reply in slowlog get, expected at least 1","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command.go","lineNumber":5726,"sourceCode":"\n\t\tcreatedAt, err := rd.ReadInt()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcmd.val[i].Time = time.Unix(createdAt, 0)\n\n\t\tcosts, err := rd.ReadInt()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcmd.val[i].Duration = time.Duration(costs) * time.Microsecond\n\n\t\tcmdLen, err := rd.ReadArrayLen()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif cmdLen < 1 {\n\t\t\treturn fmt.Errorf(\"redis: got %d elements commands reply in slowlog get, expected at least 1\", cmdLen)\n\t\t}\n\n\t\tcmd.val[i].Args = make([]string, cmdLen)\n\t\tfor f := 0; f < len(cmd.val[i].Args); f++ {\n\t\t\tcmd.val[i].Args[f], err = rd.ReadString()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif nn >= 5 {\n\t\t\tif cmd.val[i].ClientAddr, err = rd.ReadString(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tif nn >= 6 {\n\t\t\tif cmd.val[i].ClientName, err = rd.ReadString(); err != nil {","sourceCodeStart":5708,"sourceCodeEnd":5744,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/command.go#L5708-L5744","documentation":"Thrown by SlowLogCmd.readReply (command.go:5726). Inside each SLOWLOG GET entry the fourth field is itself an array of command arguments; the parser requires at least one element (the command name). A zero-length args array is rejected because it cannot represent any command.","triggerScenarios":"client.SlowLogGet(ctx, num) when a slowlog entry's command-args sub-array is empty — a malformed/corrupted reply or a non-conformant server.","commonSituations":"Corrupted RESP frame during transport; a Redis fork/proxy that emits empty command arrays; extremely rare server-side corruption.","solutions":["Inspect raw SLOWLOG GET output and confirm every entry's command-arg array is non-empty.","Eliminate proxies/intermediaries that may rewrite the reply.","Retry on a fresh connection if the failure is sporadic.","Upgrade go-redis and Redis to current stable versions."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"entries, err := client.SlowLogGet(ctx, 128).Result()\nif err != nil {\n    // likely transport corruption or non-conformant server; log and continue\n    entries = nil\n}","preventionTips":["Treat SLOWLOG collection as best-effort and never fail user requests on it.","Keep transport/proxy path clean."],"tags":["slowlog","resp-parsing","data-corruption","observability"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}