{"id":"1121fdeff87e750a","repo":"go-redis/redis","slug":"no-data-returned","errorCode":null,"errorMessage":"no data returned","messagePattern":"no data returned","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"search_commands.go","lineNumber":917,"sourceCode":"\t\tif options.Params != nil {\n\t\t\tqueryArgs = append(queryArgs, \"PARAMS\", len(options.Params)*2)\n\t\t\tfor key, value := range options.Params {\n\t\t\t\tqueryArgs = append(queryArgs, key, value)\n\t\t\t}\n\t\t}\n\n\t\tif options.DialectVersion > 0 {\n\t\t\tqueryArgs = append(queryArgs, \"DIALECT\", options.DialectVersion)\n\t\t} else {\n\t\t\tqueryArgs = append(queryArgs, \"DIALECT\", 2)\n\t\t}\n\t}\n\treturn queryArgs, nil\n}\n\nfunc ProcessAggregateResult(data []interface{}) (*FTAggregateResult, error) {\n\tif len(data) == 0 {\n\t\treturn nil, fmt.Errorf(\"no data returned\")\n\t}\n\n\ttotal, ok := data[0].(int64)\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"invalid total format\")\n\t}\n\n\trows := make([]AggregateRow, 0, len(data)-1)\n\tfor _, row := range data[1:] {\n\t\tfields, ok := row.([]interface{})\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"invalid row format\")\n\t\t}\n\n\t\trowMap := make(map[string]interface{})\n\t\tfor i := 0; i < len(fields); i += 2 {\n\t\t\tkey, ok := fields[i].(string)\n\t\t\tif !ok {","sourceCodeStart":899,"sourceCodeEnd":935,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/search_commands.go#L899-L935","documentation":"Returned by ProcessAggregateResult when the RESP2 FT.AGGREGATE reply array is empty (len 0). The expected RESP2 layout is [total, row, row, ...] with at least the total count, so a zero-length slice means no usable data was returned. This is a client-side decoding guard, not a server-issued error string.","triggerScenarios":"AggregateCmd.readReply decoding a RESP2 reply whose top-level array has zero elements. Triggered during response decoding; the server returned [] rather than the expected [N, ...rows].","commonSituations":"A proxy or middleware stripped the response. An unexpected RESP3 reply being interpreted as RESP2 (or vice versa). A server bug returning an empty array. Connection/command instrumentation mangling the frame. Very rarely, an upstream error swallowed into an empty reply.","solutions":["Inspect cmd.RawVal() / cmd.RawResult() to confirm the reply was actually an empty array.","Verify the protocol negotiated with the server (Options.Protocol 2 vs 3) matches the reply type the server sent.","Reproduce the same FT.AGGREGATE with redis-cli to see whether the empty reply originates at the server.","If a proxy is in the path, bypass it to localize the issue."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"res, err := cmd.Result()\nif err != nil {\n    if errors.Is(err, /* wrap of */ errors.New(\"no data returned\")) || err.Error() == \"no data returned\" {\n        raw, _ := cmd.RawResult()\n        log.Printf(\"empty aggregate reply, raw=%v\", raw)\n    }\n    return nil, err\n}","preventionTips":["Always inspect cmd.RawResult() when a decode error fires to confirm the actual server reply.","Verify protocol negotiation (RESP2 vs RESP3) matches the server.","Bypass RESP-mangling proxies to localize empty-reply issues."],"tags":["ft-aggregate","response-decoding","resp2","empty-reply"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}