{"record":{"id":"6cfe64ae4bc7772c","repo":"redis/go-redis","slug":"ft-hybrid-vector-data-is-required","errorCode":null,"errorMessage":"FT.HYBRID: vector data is required","messagePattern":"FT\\.HYBRID: vector data is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"search_commands.go","lineNumber":3783,"sourceCode":"// The 'index' parameter specifies the index to search, 'searchExpr' is the search query,\n// 'vectorField' is the name of the vector field, and 'vectorData' is the vector to search with.\n// FTHybrid is still experimental, the command behaviour and signature may change\nfunc (c cmdable) FTHybrid(ctx context.Context, index string, searchExpr string, vectorField string, vectorData Vector) *FTHybridCmd {\n\toptions := &FTHybridOptions{\n\t\tCountExpressions: 2,\n\t\tSearchExpressions: []FTHybridSearchExpression{\n\t\t\t{Query: searchExpr},\n\t\t},\n\t\tVectorExpressions: []FTHybridVectorExpression{\n\t\t\t{VectorField: vectorField, VectorData: vectorData},\n\t\t},\n\t}\n\treturn c.FTHybridWithArgs(ctx, index, options)\n}\n\nfunc hybridVectorBlob(v Vector) (interface{}, error) {\n\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:","sourceCodeStart":3765,"sourceCodeEnd":3801,"githubUrl":"https://github.com/redis/go-redis/blob/c5cad058c72f58370553b48566302303cf8a2e89/search_commands.go#L3765-L3801","documentation":"FTHybrid requires actual vector data for the KNN query. hybridVectorBlob receives the Vector argument and returns this error when it is nil, failing the command before anything is sent to Redis.","triggerScenarios":"Calling FTHybridWithArgs (or FTHybrid) with VectorData set to nil in the HybridVectorOptions / vector expression.","commonSituations":"Building query options dynamically where the embedding generation step failed and left the vector nil; copying struct fields and dropping the vector; JSON-unmarshaled options that omitted the field.","solutions":["Provide a non-nil vector (e.g. &redis.VectorFP32{Val: ...} or a Vector built from floats).","Check the code path that produces your embeddings for nil returns before calling FTHybrid.","If you intend to reference a stored vector instead, use VectorRef rather than a nil data vector."],"exampleFix":"// before\nopts := redis.FTHybridOptions{Vector: nil}\n// after\nopts := redis.FTHybridOptions{Vector: &redis.VectorFP32{Val: []float32{0.1, 0.2, 0.3}}}","handlingStrategy":"validation","validationCode":"if opts.Vector == nil {\n    return errors.New(\"FT.HYBRID: provide a non-nil vector\")\n}","typeGuard":"func hasVector(v redis.Vector) bool { return v != nil }","tryCatchPattern":"cmd := client.FTHybridWithArgs(ctx, \"idx\", opts)\nif err := cmd.Err(); err != nil && strings.Contains(err.Error(), \"vector data is required\") {\n    // regenerate embeddings and rebuild options\n}","preventionTips":["Fail fast where embeddings are produced if empty","Never leave VectorData nil when using KNN","Add constructor helpers that guarantee a vector is set"],"tags":["search","vector","ft-hybrid","validation"],"backgroundTag":"missing-required-value","analyzedSha":"c5cad058c72f58370553b48566302303cf8a2e89","analyzedAt":"2026-09-01T06:50:53.388Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}