{"id":"e6273d1742449193","repo":"go-redis/redis","slug":"ft-create-schema-fieldtype-geoshape-is-required-f","errorCode":null,"errorMessage":"FT.CREATE: SCHEMA FieldType GEOSHAPE is required for GeoShapeFieldType","messagePattern":"FT\\.CREATE: SCHEMA FieldType GEOSHAPE is required for GeoShapeFieldType","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"search_commands.go","lineNumber":1583,"sourceCode":"\t\t\t\t\tvamanaArgs = append(vamanaArgs, \"SEARCH_WINDOW_SIZE\", schema.VectorArgs.VamanaOptions.SearchWindowSize)\n\t\t\t\t}\n\t\t\t\tif schema.VectorArgs.VamanaOptions.Epsilon > 0 {\n\t\t\t\t\tvamanaArgs = append(vamanaArgs, \"EPSILON\", schema.VectorArgs.VamanaOptions.Epsilon)\n\t\t\t\t}\n\t\t\t\tif schema.VectorArgs.VamanaOptions.TrainingThreshold > 0 {\n\t\t\t\t\tvamanaArgs = append(vamanaArgs, \"TRAINING_THRESHOLD\", schema.VectorArgs.VamanaOptions.TrainingThreshold)\n\t\t\t\t}\n\t\t\t\tif schema.VectorArgs.VamanaOptions.ReduceDim > 0 {\n\t\t\t\t\tvamanaArgs = append(vamanaArgs, \"REDUCE\", schema.VectorArgs.VamanaOptions.ReduceDim)\n\t\t\t\t}\n\t\t\t\targs = append(args, len(vamanaArgs))\n\t\t\t\targs = append(args, vamanaArgs...)\n\t\t\t}\n\t\t}\n\t\tif schema.GeoShapeFieldType != \"\" {\n\t\t\tif schema.FieldType != SearchFieldTypeGeoShape {\n\t\t\t\tcmd := NewStatusCmd(ctx, args...)\n\t\t\t\tcmd.SetErr(fmt.Errorf(\"FT.CREATE: SCHEMA FieldType GEOSHAPE is required for GeoShapeFieldType\"))\n\t\t\t\treturn cmd\n\t\t\t}\n\t\t\targs = append(args, schema.GeoShapeFieldType)\n\t\t}\n\t\tif schema.NoStem {\n\t\t\targs = append(args, \"NOSTEM\")\n\t\t}\n\t\tif schema.Sortable {\n\t\t\targs = append(args, \"SORTABLE\")\n\t\t}\n\t\tif schema.UNF {\n\t\t\targs = append(args, \"UNF\")\n\t\t}\n\t\tif schema.NoIndex {\n\t\t\targs = append(args, \"NOINDEX\")\n\t\t}\n\t\tif schema.PhoneticMatcher != \"\" {\n\t\t\targs = append(args, \"PHONETIC\", schema.PhoneticMatcher)","sourceCodeStart":1565,"sourceCodeEnd":1601,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/search_commands.go#L1565-L1601","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n&redis.FieldSchema{FieldName: \"geom\", FieldType: redis.SearchFieldTypeTag, GeoShapeFieldType: \"FLAT\"}\n\n// after\n&redis.FieldSchema{FieldName: \"geom\", FieldType: redis.SearchFieldTypeGeoShape, GeoShapeFieldType: \"FLAT\"}","handlingStrategy":"validation","validationCode":"if f.GeoShapeFieldType != \"\" && f.FieldType != redis.SearchFieldTypeGeoShape {\n    return fmt.Errorf(\"field %q: GeoShapeFieldType requires FieldType=GEOSHAPE\", f.FieldName)\n}","typeGuard":"func geoShapeConsistent(f *redis.FieldSchema) bool {\n    if f.GeoShapeFieldType == \"\" {\n        return true\n    }\n    return f.FieldType == redis.SearchFieldTypeGeoShape\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["redisearch","ft-create","geoshape","schema","validation"],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}