{"id":"0f3f3e73d3ad6f9e","repo":"go-redis/redis","slug":"invalid-suggestion-score-format","errorCode":null,"errorMessage":"invalid suggestion score format","messagePattern":"invalid suggestion score format","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"search_commands.go","lineNumber":2560,"sourceCode":"\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"invalid term format\")\n\t\t}\n\n\t\tsuggestionsData, ok := termInfo[2].([]interface{})\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"invalid suggestions format\")\n\t\t}\n\n\t\tsuggestions := make([]SpellCheckSuggestion, 0, len(suggestionsData))\n\t\tfor _, suggestionData := range suggestionsData {\n\t\t\tsuggestionInfo, ok := suggestionData.([]interface{})\n\t\t\tif !ok || len(suggestionInfo) != 2 {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid suggestion format\")\n\t\t\t}\n\n\t\t\tscoreStr, ok := suggestionInfo[0].(string)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid suggestion score format\")\n\t\t\t}\n\t\t\tscore, err := strconv.ParseFloat(scoreStr, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid suggestion score value\")\n\t\t\t}\n\n\t\t\tsuggestion, ok := suggestionInfo[1].(string)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"invalid suggestion format\")\n\t\t\t}\n\n\t\t\tsuggestions = append(suggestions, SpellCheckSuggestion{\n\t\t\t\tScore:      score,\n\t\t\t\tSuggestion: suggestion,\n\t\t\t})\n\t\t}\n\n\t\tresults = append(results, SpellCheckResult{","sourceCodeStart":2542,"sourceCodeEnd":2578,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/search_commands.go#L2542-L2578","documentation":"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.","triggerScenarios":"A RESP2 FT.SPELLCHECK reply where the score slot is an integer, float, or nil instead of a bulk string.","commonSituations":"Module version that returns numeric scores directly in RESP2 instead of as strings, or protocol translation by a proxy.","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."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"func scoreIsString(v interface{}) bool { _, ok := v.(string); return ok }","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"invalid suggestion score format\") {\n    // RawResult to confirm the score element type\n}","preventionTips":["Upgrade RediSearch so scores arrive as bulk strings in RESP2.","Remove any RESP-rewriting proxy.","Capture raw replies for diagnosis."],"tags":["redisearch","ft-spellcheck","resp2","parsing","score"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}