go-redis/redis · error
FT.CREATE: SCHEMA FieldType GEOSHAPE is required for GeoShap
Error message
FT.CREATE: SCHEMA FieldType GEOSHAPE is required for GeoShapeFieldType
What it means
Returned by FTCreate when GeoShapeFieldType is set (non-empty) but FieldSchema.FieldType is not SearchFieldTypeGeoShape. A GEOSHAPE field optionally takes a sub-type (FLAT/GEOJSON); setting the sub-type on a non-GEOSHAPE field is contradictory and rejected at search_commands.go:1581.
Source
Thrown at search_commands.go:1583
vamanaArgs = append(vamanaArgs, "SEARCH_WINDOW_SIZE", schema.VectorArgs.VamanaOptions.SearchWindowSize)
}
if schema.VectorArgs.VamanaOptions.Epsilon > 0 {
vamanaArgs = append(vamanaArgs, "EPSILON", schema.VectorArgs.VamanaOptions.Epsilon)
}
if schema.VectorArgs.VamanaOptions.TrainingThreshold > 0 {
vamanaArgs = append(vamanaArgs, "TRAINING_THRESHOLD", schema.VectorArgs.VamanaOptions.TrainingThreshold)
}
if schema.VectorArgs.VamanaOptions.ReduceDim > 0 {
vamanaArgs = append(vamanaArgs, "REDUCE", schema.VectorArgs.VamanaOptions.ReduceDim)
}
args = append(args, len(vamanaArgs))
args = append(args, vamanaArgs...)
}
}
if schema.GeoShapeFieldType != "" {
if schema.FieldType != SearchFieldTypeGeoShape {
cmd := NewStatusCmd(ctx, args...)
cmd.SetErr(fmt.Errorf("FT.CREATE: SCHEMA FieldType GEOSHAPE is required for GeoShapeFieldType"))
return cmd
}
args = append(args, schema.GeoShapeFieldType)
}
if schema.NoStem {
args = append(args, "NOSTEM")
}
if schema.Sortable {
args = append(args, "SORTABLE")
}
if schema.UNF {
args = append(args, "UNF")
}
if schema.NoIndex {
args = append(args, "NOINDEX")
}
if schema.PhoneticMatcher != "" {
args = append(args, "PHONETIC", schema.PhoneticMatcher)View on GitHub (pinned to 36d97525cd)
Solutions
- Set FieldType: redis.SearchFieldTypeGeoShape whenever GeoShapeFieldType is non-empty.
- Constrain GeoShapeFieldType assignment to a geo-field constructor.
- Validate that GeoShapeFieldType implies SearchFieldTypeGeoShape before calling FTCreate.
Example fix
// before
&redis.FieldSchema{FieldName: "geom", FieldType: redis.SearchFieldTypeTag, GeoShapeFieldType: "FLAT"}
// after
&redis.FieldSchema{FieldName: "geom", FieldType: redis.SearchFieldTypeGeoShape, GeoShapeFieldType: "FLAT"} Defensive patterns
Strategy: validation
Validate before calling
if f.GeoShapeFieldType != "" && f.FieldType != redis.SearchFieldTypeGeoShape {
return fmt.Errorf("field %q: GeoShapeFieldType requires FieldType=GEOSHAPE", f.FieldName)
} Type guard
func geoShapeConsistent(f *redis.FieldSchema) bool {
if f.GeoShapeFieldType == "" {
return true
}
return f.FieldType == redis.SearchFieldTypeGeoShape
} Prevention
- Only set GeoShapeFieldType from within a geo-field constructor.
- Pair GeoShapeFieldType with FieldType: SearchFieldTypeGeoShape always.
- Add a test asserting geo sub-types imply GEOSHAPE fields.
When it happens
Trigger: Setting schema.GeoShapeFieldType (e.g. "FLAT") on a FieldSchema whose FieldType is TEXT/NUMERIC/etc., or forgetting to set FieldType: SearchFieldTypeGeoShape when adding the geo sub-type.
Common situations: Reusing a generic FieldSchema builder and conditionally adding GeoShapeFieldType without also switching FieldType, or copy-paste from a geo example into a text field definition.
Related errors
- FT.CREATE: SCHEMA is required
- FT.CREATE: SCHEMA FieldName and FieldType are required
- FT.CREATE: SCHEMA FieldType VECTOR is required for VectorArg
- FT.CREATE: SCHEMA VectorArgs must have exactly one of FlatOp
- FT.CREATE: Type, Dim and DistanceMetric are required for VEC
AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06).
Data as JSON: /data/errors/e6273d1742449193.json.
Report an issue: GitHub.