{"id":"b62cb86cafb3c1e2","repo":"go-redis/redis","slug":"invalid-synonyms-format","errorCode":null,"errorMessage":"invalid synonyms format","messagePattern":"invalid synonyms format","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"search_commands.go","lineNumber":3611,"sourceCode":"\t\treturn err\n\t}\n\n\t// RESP2 format\n\ttermSynonymPairs, err := rd.ReadSlice()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar results []FTSynDumpResult\n\tfor i := 0; i < len(termSynonymPairs); i += 2 {\n\t\tterm, ok := termSynonymPairs[i].(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"invalid term format\")\n\t\t}\n\n\t\tsynonyms, ok := termSynonymPairs[i+1].([]interface{})\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"invalid synonyms format\")\n\t\t}\n\n\t\tsynonymList := make([]string, len(synonyms))\n\t\tfor j, syn := range synonyms {\n\t\t\tsynonym, ok := syn.(string)\n\t\t\tif !ok {\n\t\t\t\treturn fmt.Errorf(\"invalid synonym format\")\n\t\t\t}\n\t\t\tsynonymList[j] = synonym\n\t\t}\n\n\t\tresults = append(results, FTSynDumpResult{\n\t\t\tTerm:     term,\n\t\t\tSynonyms: synonymList,\n\t\t})\n\t}\n\n\tcmd.val = results","sourceCodeStart":3593,"sourceCodeEnd":3629,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/search_commands.go#L3593-L3629","documentation":"Returned in FTSynDumpCmd.readReply (search_commands.go:3609-3612): each term's synonyms value must be a []interface{} (an array of synonym-group IDs). A non-array value here trips this error.","triggerScenarios":"FTSynDump reply where the synonyms slot is a scalar (string, nil) instead of an array — typically version drift or a malformed reply.","commonSituations":"Older/newer module variant returning a single ID instead of a list, or a proxy mangling the reply.","solutions":["Inspect cmd.RawVal() to see the synonyms value and its type.","Reproduce via redis-cli FT.SYNDUMP <idx>.","Upgrade Redis Stack and go-redis to current versions.","File a go-redis issue with the raw payload if persistent."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"res, err := client.FTSynDump(ctx, idx).Result()\nif err != nil && strings.Contains(err.Error(), \"invalid synonyms format\") {\n    raw, _ := cmd.RawVal()\n    log.Printf(\"ft.syndump synonyms not array; raw=%#v\", raw)\n}","preventionTips":["Upgrade Redis Stack and go-redis together.","Inspect RawVal() to see the synonyms value type.","Reproduce via redis-cli FT.SYNDUMP."],"tags":["redisearch","ft-syndump","resp2","response-parsing"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}