go-redis/redis · error

invalid results format

Error message

invalid results format

What it means

Raised in parseFTHybrid (search_commands.go:3069-3072) when the 'results' entry of the FTHybrid reply map is not a []interface{}. The results must be an array of result items.

Source

Thrown at search_commands.go:3071

		vsimCursorID, ok2 := resultMap["VSIM"].(int64)
		if !ok1 || !ok2 {
			return FTHybridResult{}, nil, fmt.Errorf("invalid cursor result format")
		}
		return FTHybridResult{}, &FTHybridCursorResult{
			SearchCursorID: int(searchCursorID),
			VsimCursorID:   int(vsimCursorID),
		}, nil
	}

	// Parse regular result
	totalResults, ok := resultMap["total_results"].(int64)
	if !ok {
		return FTHybridResult{}, nil, fmt.Errorf("invalid total_results format")
	}

	resultsData, ok := resultMap["results"].([]interface{})
	if !ok {
		return FTHybridResult{}, nil, fmt.Errorf("invalid results format")
	}

	// Parse each result item
	results := make([]map[string]interface{}, 0, len(resultsData))
	for _, item := range resultsData {
		// Try parsing as map[string]interface{} first (RESP3 format)
		if itemMap, ok := item.(map[string]interface{}); ok {
			results = append(results, itemMap)
			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
				}

View on GitHub (pinned to 36d97525cd)

Solutions

  1. Inspect RawResult() for the 'results' value's Go type.
  2. Confirm the server hybrid module is the version go-redis targets.
  3. Upgrade both ends to current versions.
  4. Reproduce via redis-cli.
Defensive patterns

Strategy: try-catch

Try / catch

res, _, err := client.FTHybridWithArgs(ctx, idx, opts).Result()
if err != nil && strings.Contains(err.Error(), "invalid results format") {
    raw, _ := cmd.RawVal()
    log.Printf("fthybrid results not array; raw=%#v", raw)
}

Prevention

When it happens

Trigger: FHybrid reply where 'results' is missing (nil), or returned as a map/string instead of an array — usually due to version drift.

Common situations: Mismatched module versions, or a reply shape where the server collapsed results into a different container.

Related errors


AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06). Data as JSON: /data/errors/fb0e21c0b63c9b2f.json. Report an issue: GitHub.