{"id":"01166cf98282401f","repo":"go-redis/redis","slug":"invalid-row-format","errorCode":null,"errorMessage":"invalid row format","messagePattern":"invalid row format","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"search_commands.go","lineNumber":929,"sourceCode":"\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 {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid field key format\")\n\t\t\t}\n\t\t\tvalue := fields[i+1]\n\t\t\trowMap[key] = value\n\t\t}\n\t\trows = append(rows, AggregateRow{Fields: rowMap})\n\t}\n\n\tresult := &FTAggregateResult{\n\t\tTotal: int(total),\n\t\tRows:  rows,\n\t}","sourceCodeStart":911,"sourceCodeEnd":947,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/search_commands.go#L911-L947","documentation":"Returned by ProcessAggregateResult when an element of the RESP2 reply (after the total) is not a []interface{}. Each row in FT.AGGREGATE RESP2 is itself a flat array of [key, value, key, value, ...]; a row that is a string, nil, or any non-array type triggers this guard.","triggerScenarios":"AggregateCmd.readReply decoding a RESP2 reply where data[i] (i >= 1) is not a slice. Triggered during response decoding while iterating rows.","commonSituations":"Server returned an error or status string interleaved with rows. RESP3/RESP2 mismatch. Proxy corrupting the frame. A row containing a nested non-array element due to a server bug.","solutions":["Inspect cmd.RawVal() to identify the offending row element and its type.","Verify the negotiated protocol (RESP2 vs RESP3) matches the server reply.","Reproduce with redis-cli to see whether the malformed row originates at the server.","Check for proxies or middleware that may rewrite the reply."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"res, err := cmd.Result()\nif err != nil && strings.Contains(err.Error(), \"invalid row format\") {\n    raw, _ := cmd.RawResult()\n    log.Printf(\"aggregate row not array; raw=%v\", raw)\n}\nreturn err","preventionTips":["Verify protocol negotiation matches the server reply type.","Bypass proxies that may rewrite the frame.","Capture raw replies in telemetry to diagnose row-shape corruption."],"tags":["ft-aggregate","response-decoding","resp2","type-mismatch"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}