{"id":"05e9fddd0f18effb","repo":"go-redis/redis","slug":"invalid-field-value-format","errorCode":null,"errorMessage":"invalid field value format","messagePattern":"invalid field value format","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"search_commands.go","lineNumber":2678,"sourceCode":"\t\t\tfields, ok := data[i].([]interface{})\n\t\t\tif !ok {\n\t\t\t\tif data[i] == proto.Nil || data[i] == nil {\n\t\t\t\t\tdoc.Error = proto.Nil\n\t\t\t\t\tdoc.Fields = map[string]string{}\n\t\t\t\t\tfields = []interface{}{}\n\t\t\t\t} else {\n\t\t\t\t\treturn FTSearchResult{}, fmt.Errorf(\"invalid document fields format\")\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor j := 0; j < len(fields); j += 2 {\n\t\t\t\tkey, ok := fields[j].(string)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn FTSearchResult{}, fmt.Errorf(\"invalid field key format\")\n\t\t\t\t}\n\t\t\t\tvalue, ok := fields[j+1].(string)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn FTSearchResult{}, fmt.Errorf(\"invalid field value format\")\n\t\t\t\t}\n\t\t\t\tdoc.Fields[key] = value\n\t\t\t}\n\t\t\ti++\n\t\t}\n\n\t\tresults = append(results, doc)\n\t}\n\treturn FTSearchResult{\n\t\tTotal: int(total),\n\t\tDocs:  results,\n\t}, nil\n}\n\ntype FTSearchCmd struct {\n\tbaseCmd\n\tval     FTSearchResult\n\toptions *FTSearchOptions","sourceCodeStart":2660,"sourceCodeEnd":2696,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/search_commands.go#L2660-L2696","documentation":"Companion to the previous check (search_commands.go:2676-2678): each field's value (odd-index element) must also be a string in the FT.SEARCH reply. A non-string value trips this error.","triggerScenarios":"Server returned a non-string field value (e.g. an integer where go-redis expects a string-encoded value), or a misaligned parser read a key as a value.","commonSituations":"Schema/encoding mismatch (e.g. SORTABLE numeric returned as int), proxy-induced shape changes, or version drift.","solutions":["Inspect RawResult() to find the failing field index.","Confirm the index schema and AS clause produce string-encoded values.","Compare with redis-cli output.","Upgrade server and client."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"invalid field value format\") {\n    raw, _ := cmd.RawResult()\n    log.Printf(\"field value not string; raw=%#v\", raw)\n}","preventionTips":["Keep RETURN/LOAD clauses so values stay string-encoded.","Upgrade server and client in lockstep.","Capture RawResult() for diagnosis."],"tags":["redisearch","ft-search","resp2","response-parsing"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}