{"record":{"id":"e0e512d88faac9e8","repo":"redis/go-redis","slug":"ft-hybrid-unsupported-vector-type-t","errorCode":null,"errorMessage":"FT.HYBRID: unsupported vector type %T","messagePattern":"FT\\.HYBRID: unsupported vector type %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"search_commands.go","lineNumber":3800,"sourceCode":"\tif v == nil {\n\t\treturn nil, fmt.Errorf(\"FT.HYBRID: vector data is required\")\n\t}\n\n\tswitch vector := v.(type) {\n\tcase *VectorFP32:\n\t\treturn hybridVectorBytes(vector.Val)\n\tcase *VectorFloat16:\n\t\treturn hybridVectorBytes(vector.Val)\n\tcase *VectorBFloat16:\n\t\treturn hybridVectorBytes(vector.Val)\n\tcase *VectorFloat64:\n\t\treturn hybridVectorBytes(vector.Val)\n\tcase *VectorInt8:\n\t\treturn hybridVectorBytes(vector.Val)\n\tcase *VectorUint8:\n\t\treturn hybridVectorBytes(vector.Val)\n\tcase *VectorValues, *VectorRef:\n\t\treturn nil, fmt.Errorf(\"FT.HYBRID: unsupported vector type %T\", v)\n\tdefault:\n\t\tvalues := v.Value()\n\t\tif len(values) < 2 {\n\t\t\treturn nil, fmt.Errorf(\"FT.HYBRID: vector Value must contain a blob at index 1\")\n\t\t}\n\t\treturn values[1], nil\n\t}\n}\n\nfunc hybridVectorBytes(blob []byte) ([]byte, error) {\n\tif len(blob) == 0 {\n\t\treturn nil, fmt.Errorf(\"FT.HYBRID: vector blob is required\")\n\t}\n\treturn blob, nil\n}\n\n// generateVectorParamName returns a parameter name that is not already present\n// in params. It is used to pass vector data via the PARAMS mechanism when the","sourceCodeStart":3782,"sourceCodeEnd":3818,"githubUrl":"https://github.com/redis/go-redis/blob/c5cad058c72f58370553b48566302303cf8a2e89/search_commands.go#L3782-L3818","documentation":"The FTHybrid vector blob builder only accepts byte-backed vector types (*VectorFP32, *VectorFloat16, *VectorInt8, *VectorUint8) or any custom type exposing Value() with a blob at index 1. Passing a symbolic/vector-first type like *VectorValues or *VectorRef is rejected because FT.HYBRID's KNN input must be raw bytes.","triggerScenarios":"Calling FTHybridWithArgs with Vector set to &redis.VectorValues{...} or &redis.VectorRef{...}, or an unsupported Vector implementation.","commonSituations":"Reusing a vector type created for FT.KNN search options in FT.HYBRID; confusing reference-style vectors (pointing at stored/embedded data) with inline blob vectors.","solutions":["Use a byte-backed type such as *VectorFP32 (or *VectorFloat16/*VectorInt8/*VectorUint8).","If you have floats, wrap them in a blob-carrying vector instead of VectorValues.","Implement a custom Vector whose Value() returns [name, blob] with the binary data at index 1."],"exampleFix":"// before\nvec := &redis.VectorValues{Val: []float64{0.1, 0.2}}\n// after\nvec := &redis.VectorFP32{Val: []float32{0.1, 0.2}}","handlingStrategy":"type-guard","validationCode":"switch v.(type) {\ncase *redis.VectorValues, *redis.VectorRef:\n    return errors.New(\"FT.HYBRID needs a blob-backed vector, not VectorValues/VectorRef\")\n}","typeGuard":"func isBlobVector(v redis.Vector) bool {\n    switch v.(type) {\n    case *redis.VectorFP32, *redis.VectorFloat16, *redis.VectorInt8, *redis.VectorUint8:\n        return true\n    default:\n        return false\n    }\n}","tryCatchPattern":"cmd := client.FTHybridWithArgs(ctx, \"idx\", opts)\nif err := cmd.Err(); err != nil && strings.Contains(err.Error(), \"unsupported vector type\") {\n    // swap the vector implementation and retry once\n}","preventionTips":["Keep a single blob-backed vector type for FT.HYBRID queries","Don't reuse FT.KNN VectorValues/VectorRef types in HYBRID","Document the accepted Vector implementations in your codebase"],"tags":["search","vector","ft-hybrid","type-mismatch"],"backgroundTag":"unsupported-type","analyzedSha":"c5cad058c72f58370553b48566302303cf8a2e89","analyzedAt":"2026-09-01T06:50:53.388Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}