redis/go-redis · error

invalid results format: expected map, got %T

Error message

invalid results format: expected map, got %T

What it means

Error "invalid results format: expected map, got %T" thrown in redis/go-redis.

Source

Thrown at search_commands.go:2473

//	  "results": map{
//	    "misspelled_term": [
//	      map{"suggestion": score},
//	      ...
//	    ],
//	    ...
//	  }
//	}
func parseFTSpellCheckRESP3(data map[interface{}]interface{}) ([]SpellCheckResult, error) {
	results := make([]SpellCheckResult, 0)

	resultsData, ok := data["results"]
	if !ok {
		return results, nil
	}

	resultsMap, ok := resultsData.(map[interface{}]interface{})
	if !ok {
		return nil, fmt.Errorf("invalid results format: expected map, got %T", resultsData)
	}

	for termKey, suggestionsData := range resultsMap {
		term, ok := termKey.(string)
		if !ok {
			continue
		}

		suggestionsArray, ok := suggestionsData.([]interface{})
		if !ok {
			continue
		}

		suggestions := make([]SpellCheckSuggestion, 0, len(suggestionsArray))
		for _, suggestionData := range suggestionsArray {
			suggestionMap, ok := suggestionData.(map[interface{}]interface{})
			if !ok {
				continue

View on GitHub (pinned to c5cad058c7)

When it happens

Trigger: Thrown at search_commands.go:2473 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of redis/go-redis@c5cad058c7 (2026-09-01). Data as JSON: /api/errors/29cb1e752d382a6d. Report an issue: GitHub.