{"id":"bda7b733ef6e4d48","repo":"go-redis/redis","slug":"ft-create-type-dim-and-distancemetric-are-requir-bda7b7","errorCode":null,"errorMessage":"FT.CREATE: Type, Dim and DistanceMetric are required for VECTOR VAMANA","messagePattern":"FT\\.CREATE: Type, Dim and DistanceMetric are required for VECTOR VAMANA","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"search_commands.go","lineNumber":1547,"sourceCode":"\t\t\t\t}\n\t\t\t\tif schema.VectorArgs.HNSWOptions.Epsilon > 0 {\n\t\t\t\t\thnswArgs = append(hnswArgs, \"EPSILON\", schema.VectorArgs.HNSWOptions.Epsilon)\n\t\t\t\t}\n\t\t\t\tif schema.VectorArgs.HNSWOptions.Rerank || schema.VectorArgs.HNSWOptions.HasRerank {\n\t\t\t\t\trerank := \"FALSE\"\n\t\t\t\t\tif schema.VectorArgs.HNSWOptions.Rerank {\n\t\t\t\t\t\trerank = \"TRUE\"\n\t\t\t\t\t}\n\t\t\t\t\thnswArgs = append(hnswArgs, \"RERANK\", rerank)\n\t\t\t\t}\n\t\t\t\targs = append(args, len(hnswArgs))\n\t\t\t\targs = append(args, hnswArgs...)\n\t\t\t}\n\t\t\tif schema.VectorArgs.VamanaOptions != nil {\n\t\t\t\targs = append(args, \"SVS-VAMANA\")\n\t\t\t\tif schema.VectorArgs.VamanaOptions.Type == \"\" || schema.VectorArgs.VamanaOptions.Dim == 0 || schema.VectorArgs.VamanaOptions.DistanceMetric == \"\" {\n\t\t\t\t\tcmd := NewStatusCmd(ctx, args...)\n\t\t\t\t\tcmd.SetErr(fmt.Errorf(\"FT.CREATE: Type, Dim and DistanceMetric are required for VECTOR VAMANA\"))\n\t\t\t\t\treturn cmd\n\t\t\t\t}\n\t\t\t\tvamanaArgs := []interface{}{\n\t\t\t\t\t\"TYPE\", schema.VectorArgs.VamanaOptions.Type,\n\t\t\t\t\t\"DIM\", schema.VectorArgs.VamanaOptions.Dim,\n\t\t\t\t\t\"DISTANCE_METRIC\", schema.VectorArgs.VamanaOptions.DistanceMetric,\n\t\t\t\t}\n\t\t\t\tif schema.VectorArgs.VamanaOptions.Compression != \"\" {\n\t\t\t\t\tvamanaArgs = append(vamanaArgs, \"COMPRESSION\", schema.VectorArgs.VamanaOptions.Compression)\n\t\t\t\t}\n\t\t\t\tif schema.VectorArgs.VamanaOptions.ConstructionWindowSize > 0 {\n\t\t\t\t\tvamanaArgs = append(vamanaArgs, \"CONSTRUCTION_WINDOW_SIZE\", schema.VectorArgs.VamanaOptions.ConstructionWindowSize)\n\t\t\t\t}\n\t\t\t\tif schema.VectorArgs.VamanaOptions.GraphMaxDegree > 0 {\n\t\t\t\t\tvamanaArgs = append(vamanaArgs, \"GRAPH_MAX_DEGREE\", schema.VectorArgs.VamanaOptions.GraphMaxDegree)\n\t\t\t\t}\n\t\t\t\tif schema.VectorArgs.VamanaOptions.SearchWindowSize > 0 {\n\t\t\t\t\tvamanaArgs = append(vamanaArgs, \"SEARCH_WINDOW_SIZE\", schema.VectorArgs.VamanaOptions.SearchWindowSize)","sourceCodeStart":1529,"sourceCodeEnd":1565,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/search_commands.go#L1529-L1565","documentation":"Returned by FTCreate when VamanaOptions is selected but Type, Dim, or DistanceMetric is unset. Vamana (SVS-VAMANA) indexes require the same mandatory trio as the other algorithms. The guard is at search_commands.go:1545. Vamana support requires a recent Redis/RediSearch build.","triggerScenarios":"Constructing &redis.FTVamanaOptions{} without Type/Dim/DistanceMetric. Also reached when the server advertises Vamana but the client options struct is incompletely populated.","commonSituations":"Newer Vamana code paths where examples are sparse, or reusing an HNSW template and forgetting the Vamana-specific struct fields. Vamana is newer so version mismatches between examples and the installed Redis can mislead.","solutions":["Set VamanaOptions.Type, VamanaOptions.Dim (>0), and VamanaOptions.DistanceMetric.","Confirm the Redis server version supports SVS-VAMANA before using it (use SkipBeforeRedisVersion in tests).","Populate via a helper that takes the embedding dim and metric and fills defaults."],"exampleFix":"// before\n&redis.FTVamanaOptions{Type: \"FLOAT32\"}\n\n// after\n&redis.FTVamanaOptions{Type: \"FLOAT32\", Dim: 768, DistanceMetric: \"L2\"}","handlingStrategy":"validation","validationCode":"o := f.VectorArgs.VamanaOptions\nif o.Type == \"\" || o.Dim == 0 || o.DistanceMetric == \"\" {\n    return fmt.Errorf(\"Vamana vector field %q needs Type, Dim>0, DistanceMetric\", f.FieldName)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set the mandatory Type/Dim/DistanceMetric trio for Vamana fields.","Confirm server support for SVS-VAMANA before using it.","Reuse the same dim/metric validation helper as the other algorithms."],"tags":["redisearch","ft-create","vector","vamana","validation"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}