{"id":"7d6e8dbeeabd478a","repo":"go-redis/redis","slug":"invalid-term-format","errorCode":null,"errorMessage":"invalid term format","messagePattern":"invalid term format","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"search_commands.go","lineNumber":2538,"sourceCode":"\t\t\t}\n\t\t}\n\n\t\tresults = append(results, SpellCheckResult{\n\t\t\tTerm:        term,\n\t\t\tSuggestions: suggestions,\n\t\t})\n\t}\n\n\treturn results, nil\n}\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}","sourceCodeStart":2520,"sourceCodeEnd":2556,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/search_commands.go#L2520-L2556","documentation":"Returned by parseFTSpellCheck (RESP2 path) when a term entry is not a 3-element array. The RESP2 FT.SPELLCHECK format is [1, term, [[score, suggestion], ...]] per term; a malformed entry is rejected at search_commands.go:2537.","triggerScenarios":"A RESP2 FT.SPELLCHECK reply whose per-term element is not a []interface{} of length 3. Indicates non-standard server output or a protocol/translation issue.","commonSituations":"Custom Redis proxy rewriting replies, an incompatible Redis fork, or running against a non-RediSearch backend that happens to answer the command.","solutions":["Verify you are talking to a real Redis Stack / RediSearch instance.","Upgrade RediSearch to a version whose SPELLCHECK output matches the documented RESP2 schema.","Inspect the raw reply (use RawResult) to see what the server actually returned."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"func isTermTuple(v interface{}) bool {\n    t, ok := v.([]interface{})\n    return ok && len(t) == 3\n}","tryCatchPattern":"res, err := client.FTSpellCheck(ctx, idx, term).Result()\nif err != nil && strings.Contains(err.Error(), \"invalid term format\") {\n    raw, _ := client.FTSpellCheck(ctx, idx, term).RawResult()\n    // log raw to diagnose server/proxy issue\n    _ = raw\n}","preventionTips":["Point the client at a genuine RediSearch-enabled Redis.","Upgrade Redis Stack/RediSearch to a current release.","Use RawResult() to capture malformed replies for diagnosis."],"tags":["redisearch","ft-spellcheck","resp2","parsing"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}