go-redis/redis · error
invalid result item format
Error message
invalid result item format
What it means
Returned in parseFTHybrid (search_commands.go:3094-3099): each entry in the results array must be either a map (RESP3 style) or an array of key/value pairs (RESP2 style). An item that is neither (scalar, nil) trips this error.
Source
Thrown at search_commands.go:3098
continue
}
// Try parsing as map[interface{}]interface{} (alternative RESP3 format)
if rawMap, ok := item.(map[interface{}]interface{}); ok {
itemMap := make(map[string]interface{})
for k, v := range rawMap {
if keyStr, ok := k.(string); ok {
itemMap[keyStr] = v
}
}
results = append(results, itemMap)
continue
}
// Fall back to array format (RESP2 format - key-value pairs)
itemData, ok := item.([]interface{})
if !ok {
return FTHybridResult{}, nil, fmt.Errorf("invalid result item format")
}
itemMap := make(map[string]interface{})
for i := 0; i < len(itemData); i += 2 {
if i+1 < len(itemData) {
key, ok := itemData[i].(string)
if !ok {
return FTHybridResult{}, nil, fmt.Errorf("invalid item key format")
}
itemMap[key] = itemData[i+1]
}
}
results = append(results, itemMap)
}
// Optional warnings; accept both "warning" (as FT.SEARCH/FT.AGGREGATE) and "warnings".
var warnings []string
warningsData, ok := resultMap["warning"].([]interface{})View on GitHub (pinned to 36d97525cd)
Solutions
- Inspect RawResult() and locate the offending result item.
- Upgrade the server module and go-redis.
- Reproduce via redis-cli.
- File a go-redis issue with the raw reply if persistent.
Defensive patterns
Strategy: try-catch
Try / catch
res, _, err := client.FTHybridWithArgs(ctx, idx, opts).Result()
if err != nil && strings.Contains(err.Error(), "invalid result item format") {
raw, _ := cmd.RawVal()
log.Printf("fthybrid result item not map/array; raw=%#v", raw)
} Prevention
- Upgrade go-redis to handle current reply variants.
- Capture RawVal() to find the offending item.
- Reproduce via redis-cli.
When it happens
Trigger: FHybrid results array containing an item of an unexpected type — e.g. a bare string or integer where a per-result map/array was expected.
Common situations: Server returned a heterogeneous or partial result list, or a future reply variant go-redis does not handle.
Related errors
- invalid key type at index %d
- invalid cursor result format
- invalid total_results format
- invalid results format
- invalid item key format
AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06).
Data as JSON: /data/errors/4eb2a7fc3fe69889.json.
Report an issue: GitHub.