{"id":"eceeb0dc943de678","repo":"go-redis/redis","slug":"invalid-suggestions-format","errorCode":null,"errorMessage":"invalid suggestions format","messagePattern":"invalid suggestions format","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"search_commands.go","lineNumber":2548,"sourceCode":"}\n\nfunc parseFTSpellCheck(data []interface{}) ([]SpellCheckResult, error) {\n\tresults := make([]SpellCheckResult, 0, len(data))\n\n\tfor _, termData := range data {\n\t\ttermInfo, ok := termData.([]interface{})\n\t\tif !ok || len(termInfo) != 3 {\n\t\t\treturn nil, fmt.Errorf(\"invalid term format\")\n\t\t}\n\n\t\tterm, ok := termInfo[1].(string)\n\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","sourceCodeStart":2530,"sourceCodeEnd":2566,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/search_commands.go#L2530-L2566","documentation":"Returned by parseFTSpellCheck (RESP2 path) when the third element of a term entry (the suggestions list) is not a []interface{}. Each term tuple is [1, term, [[score, suggestion], ...]]; the third slot must be an array. Guard at search_commands.go:2546.","triggerScenarios":"A RESP2 FT.SPELLCHECK reply where the suggestions slot is a scalar/nil/map instead of an array. Happens when a term has no suggestions and the server omits the array rather than sending an empty one.","commonSituations":"Server-version differences in how zero-suggestion terms are serialized, or proxy mangling.","solutions":["Upgrade RediSearch so empty-suggestion terms still emit an empty array.","Use cmd.RawResult() to inspect the raw structure if it recurs.","File a RediSearch issue if a genuine server returns a non-array for the suggestions slot."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"func suggestionsIsSlice(v interface{}) bool { _, ok := v.([]interface{}); return ok }","tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"invalid suggestions format\") {\n    // use RawResult to inspect the suggestions slot\n}","preventionTips":["Upgrade RediSearch so zero-suggestion terms still emit an empty array.","Inspect raw replies for non-array suggestion slots.","Confirm you hit a real RediSearch server."],"tags":["redisearch","ft-spellcheck","resp2","parsing"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}