go-redis/redis · error

FT.CREATE: Type, Dim and DistanceMetric are required for VEC

Error message

FT.CREATE: Type, Dim and DistanceMetric are required for VECTOR VAMANA

What it means

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.

Source

Thrown at search_commands.go:1547

				}
				if schema.VectorArgs.HNSWOptions.Epsilon > 0 {
					hnswArgs = append(hnswArgs, "EPSILON", schema.VectorArgs.HNSWOptions.Epsilon)
				}
				if schema.VectorArgs.HNSWOptions.Rerank || schema.VectorArgs.HNSWOptions.HasRerank {
					rerank := "FALSE"
					if schema.VectorArgs.HNSWOptions.Rerank {
						rerank = "TRUE"
					}
					hnswArgs = append(hnswArgs, "RERANK", rerank)
				}
				args = append(args, len(hnswArgs))
				args = append(args, hnswArgs...)
			}
			if schema.VectorArgs.VamanaOptions != nil {
				args = append(args, "SVS-VAMANA")
				if schema.VectorArgs.VamanaOptions.Type == "" || schema.VectorArgs.VamanaOptions.Dim == 0 || schema.VectorArgs.VamanaOptions.DistanceMetric == "" {
					cmd := NewStatusCmd(ctx, args...)
					cmd.SetErr(fmt.Errorf("FT.CREATE: Type, Dim and DistanceMetric are required for VECTOR VAMANA"))
					return cmd
				}
				vamanaArgs := []interface{}{
					"TYPE", schema.VectorArgs.VamanaOptions.Type,
					"DIM", schema.VectorArgs.VamanaOptions.Dim,
					"DISTANCE_METRIC", schema.VectorArgs.VamanaOptions.DistanceMetric,
				}
				if schema.VectorArgs.VamanaOptions.Compression != "" {
					vamanaArgs = append(vamanaArgs, "COMPRESSION", schema.VectorArgs.VamanaOptions.Compression)
				}
				if schema.VectorArgs.VamanaOptions.ConstructionWindowSize > 0 {
					vamanaArgs = append(vamanaArgs, "CONSTRUCTION_WINDOW_SIZE", schema.VectorArgs.VamanaOptions.ConstructionWindowSize)
				}
				if schema.VectorArgs.VamanaOptions.GraphMaxDegree > 0 {
					vamanaArgs = append(vamanaArgs, "GRAPH_MAX_DEGREE", schema.VectorArgs.VamanaOptions.GraphMaxDegree)
				}
				if schema.VectorArgs.VamanaOptions.SearchWindowSize > 0 {
					vamanaArgs = append(vamanaArgs, "SEARCH_WINDOW_SIZE", schema.VectorArgs.VamanaOptions.SearchWindowSize)

View on GitHub (pinned to 36d97525cd)

Solutions

  1. Set VamanaOptions.Type, VamanaOptions.Dim (>0), and VamanaOptions.DistanceMetric.
  2. Confirm the Redis server version supports SVS-VAMANA before using it (use SkipBeforeRedisVersion in tests).
  3. Populate via a helper that takes the embedding dim and metric and fills defaults.

Example fix

// before
&redis.FTVamanaOptions{Type: "FLOAT32"}

// after
&redis.FTVamanaOptions{Type: "FLOAT32", Dim: 768, DistanceMetric: "L2"}
Defensive patterns

Strategy: validation

Validate before calling

o := f.VectorArgs.VamanaOptions
if o.Type == "" || o.Dim == 0 || o.DistanceMetric == "" {
    return fmt.Errorf("Vamana vector field %q needs Type, Dim>0, DistanceMetric", f.FieldName)
}

Prevention

When it happens

Trigger: Constructing &redis.FTVamanaOptions{} without Type/Dim/DistanceMetric. Also reached when the server advertises Vamana but the client options struct is incompletely populated.

Common situations: 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.

Related errors


AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06). Data as JSON: /data/errors/bda7b733ef6e4d48.json. Report an issue: GitHub.