{"id":"13ca0e578617aa50","repo":"go-redis/redis","slug":"unexpected-resp3-response-type-t","errorCode":null,"errorMessage":"unexpected RESP3 response type: %T","messagePattern":"unexpected RESP3 response type: %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"search_commands.go","lineNumber":1007,"sourceCode":"\nfunc (cmd *AggregateCmd) readReply(rd *proto.Reader) (err error) {\n\treadType, err := rd.PeekReplyType()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// RESP3 returns a map, RESP2 returns an array\n\tif readType == proto.RespMap {\n\t\t// Read raw response first for backwards compatibility\n\t\tcmd.rawVal, err = rd.ReadReply()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Parse the raw response into structured result\n\t\tif mapVal, ok := cmd.rawVal.(map[interface{}]interface{}); ok {\n\t\t\tcmd.val, err = parseFTAggregateMapRESP3(mapVal)\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"unexpected RESP3 response type: %T\", cmd.rawVal)\n\t\t}\n\t\treturn err\n\t}\n\n\t// RESP2 format or error response - use ReadReply to handle errors properly\n\tdata, err := rd.ReadReply()\n\tif err != nil {\n\t\treturn err\n\t}\n\tcmd.rawVal = data // Store raw value for debugging\n\tif dataSlice, ok := data.([]interface{}); ok {\n\t\tcmd.val, err = ProcessAggregateResult(dataSlice)\n\t\treturn err\n\t}\n\treturn fmt.Errorf(\"unexpected response type: %T\", data)\n}\n\n// parseFTAggregateMapRESP3 parses the RESP3 format response from FT.AGGREGATE.","sourceCodeStart":989,"sourceCodeEnd":1025,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/search_commands.go#L989-L1025","documentation":"Returned by AggregateCmd.readReply when the RESP3 map framing type was detected (proto.RespMap) but the parsed rawVal is not a map[interface{}]interface{}. The RESP3 FT.AGGREGATE reply is expected to be a map with keys like total_results/results/warnings; any other concrete type under a map framing is a decoding anomaly.","triggerScenarios":"AggregateCmd.readReply peeks RespMap then ReadReply yields something other than map[interface{}]interface{}. Triggered during RESP3 response decoding.","commonSituations":"A custom or older RESP3 source that encodes the map differently. A proxy rewriting RESP3 frames. A go-redis/proto version mismatch in decoding. An unexpected RESP3 sub-type landing under the map framing.","solutions":["Inspect cmd.RawVal() to see the actual decoded type.","Confirm the server genuinely speaks RESP3 and returns a map for FT.AGGREGATE (redis-cli with RESP3).","Check for proxies/middleware mangling RESP3 frames; bypass to localize.","If using a forked/older proto decoder, align with the version bundled by this client."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"res, err := cmd.Result()\nif err != nil && strings.Contains(err.Error(), \"unexpected RESP3 response type\") {\n    raw, _ := cmd.RawResult()\n    log.Printf(\"RESP3 aggregate reply not a map; raw=%v\", raw)\n}\nreturn err","preventionTips":["Confirm the server speaks RESP3 and returns a map for FT.AGGREGATE (redis-cli with RESP3).","Use the proto decoder version bundled by this client; avoid forked/older decoders.","Bypass RESP3-mangling proxies when diagnosing."],"tags":["ft-aggregate","response-decoding","resp3","type-mismatch"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}