go-redis/redis · error
invalid suggestion score format
Error message
invalid suggestion score format
What it means
Returned by parseFTSpellCheck (RESP2 path) when the first element of a suggestion tuple (the score) is not a Go string. In RESP2 the score is sent as a bulk string (e.g. "0.9"); a non-string type fails the assertion at search_commands.go:2558.
Source
Thrown at search_commands.go:2560
if !ok {
return nil, fmt.Errorf("invalid term format")
}
suggestionsData, ok := termInfo[2].([]interface{})
if !ok {
return nil, fmt.Errorf("invalid suggestions format")
}
suggestions := make([]SpellCheckSuggestion, 0, len(suggestionsData))
for _, suggestionData := range suggestionsData {
suggestionInfo, ok := suggestionData.([]interface{})
if !ok || len(suggestionInfo) != 2 {
return nil, fmt.Errorf("invalid suggestion format")
}
scoreStr, ok := suggestionInfo[0].(string)
if !ok {
return nil, fmt.Errorf("invalid suggestion score format")
}
score, err := strconv.ParseFloat(scoreStr, 64)
if err != nil {
return nil, fmt.Errorf("invalid suggestion score value")
}
suggestion, ok := suggestionInfo[1].(string)
if !ok {
return nil, fmt.Errorf("invalid suggestion format")
}
suggestions = append(suggestions, SpellCheckSuggestion{
Score: score,
Suggestion: suggestion,
})
}
results = append(results, SpellCheckResult{View on GitHub (pinned to 36d97525cd)
Solutions
- Upgrade RediSearch to emit scores as bulk strings per the documented format.
- Inspect the raw reply to confirm the score element type.
- Remove any RESP-rewriting middlebox between client and server.
Example fix
null
Defensive patterns
Strategy: try-catch
Type guard
func scoreIsString(v interface{}) bool { _, ok := v.(string); return ok } Try / catch
if err != nil && strings.Contains(err.Error(), "invalid suggestion score format") {
// RawResult to confirm the score element type
} Prevention
- Upgrade RediSearch so scores arrive as bulk strings in RESP2.
- Remove any RESP-rewriting proxy.
- Capture raw replies for diagnosis.
When it happens
Trigger: A RESP2 FT.SPELLCHECK reply where the score slot is an integer, float, or nil instead of a bulk string.
Common situations: Module version that returns numeric scores directly in RESP2 instead of as strings, or protocol translation by a proxy.
Related errors
- invalid suggestion score value
- invalid term format
- invalid suggestions format
- invalid suggestion format
- invalid results format: expected map, got %T
AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06).
Data as JSON: /data/errors/0f3f3e73d3ad6f9e.json.
Report an issue: GitHub.