{"id":"01c0cf91168117a1","repo":"go-redis/redis","slug":"invalid-total-results-format-01c0cf","errorCode":null,"errorMessage":"invalid total_results format","messagePattern":"invalid total_results format","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"search_commands.go","lineNumber":3066,"sourceCode":"\t}\n\n\t// Handle cursor result\n\tif withCursor {\n\t\tsearchCursorID, ok1 := resultMap[\"SEARCH\"].(int64)\n\t\tvsimCursorID, ok2 := resultMap[\"VSIM\"].(int64)\n\t\tif !ok1 || !ok2 {\n\t\t\treturn FTHybridResult{}, nil, fmt.Errorf(\"invalid cursor result format\")\n\t\t}\n\t\treturn FTHybridResult{}, &FTHybridCursorResult{\n\t\t\tSearchCursorID: int(searchCursorID),\n\t\t\tVsimCursorID:   int(vsimCursorID),\n\t\t}, nil\n\t}\n\n\t// Parse regular result\n\ttotalResults, ok := resultMap[\"total_results\"].(int64)\n\tif !ok {\n\t\treturn FTHybridResult{}, nil, fmt.Errorf(\"invalid total_results format\")\n\t}\n\n\tresultsData, ok := resultMap[\"results\"].([]interface{})\n\tif !ok {\n\t\treturn FTHybridResult{}, nil, fmt.Errorf(\"invalid results format\")\n\t}\n\n\t// Parse each result item\n\tresults := make([]map[string]interface{}, 0, len(resultsData))\n\tfor _, item := range resultsData {\n\t\t// Try parsing as map[string]interface{} first (RESP3 format)\n\t\tif itemMap, ok := item.(map[string]interface{}); ok {\n\t\t\tresults = append(results, itemMap)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Try parsing as map[interface{}]interface{} (alternative RESP3 format)\n\t\tif rawMap, ok := item.(map[interface{}]interface{}); ok {","sourceCodeStart":3048,"sourceCodeEnd":3084,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/search_commands.go#L3048-L3084","documentation":"Thrown in parseFTHybrid (search_commands.go:3064-3067): the 'total_results' field of the FTHybrid reply map must be an int64. Any other type (string, float, nil, missing) trips this error.","triggerScenarios":"FTHybrid reply whose total_results was emitted as a non-integer (e.g. a string '5'), or where the field is absent so resultMap[...] yields nil.","commonSituations":"Version mismatch between go-redis and the server hybrid module, or a reply from an older/newer module variant that renamed or retyped the field.","solutions":["Inspect RawResult() for the total_results value and its Go type.","Upgrade go-redis and the hybrid module to matched versions.","Reproduce via redis-cli to see the canonical reply.","If field name changed, file a go-redis issue."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"res, _, err := client.FTHybridWithArgs(ctx, idx, opts).Result()\nif err != nil && strings.Contains(err.Error(), \"invalid total_results format\") {\n    raw, _ := cmd.RawVal()\n    log.Printf(\"fthybrid total_results not int64; raw=%#v\", raw)\n}","preventionTips":["Keep go-redis and the hybrid module on matched versions.","Inspect RawVal() to see the total_results Go type.","Reproduce via redis-cli."],"tags":["redisearch","ft-hybrid","response-parsing"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}