1416
MariaDBerrordatahigh confidence
Cannot get geometry object from data sent to GEOMETRY field
Production Risk
Medium — inserts fail; application must handle spatial data correctly.
What this means
Data inserted into a GEOMETRY column could not be parsed as a valid geometry object.
Why it happens
- 1Inserting raw bytes instead of using ST_GeomFromText() or ST_GeomFromWKB()
- 2Malformed WKT string passed to a geometry function
- 3SRID mismatch on MySQL 8.0 SRID-enforced columns
How to reproduce
trigger — this will error
trigger — this will error
INSERT INTO t (g) VALUES ('INVALID_GEOMETRY');expected output
ERROR 1416 (22003): Cannot get geometry object from data you send to the GEOMETRY field
Fix 1
Use ST_GeomFromText()
Use ST_GeomFromText()
INSERT INTO t (g) VALUES (ST_GeomFromText('POINT(1 1)'));Why this works
Converts WKT string to a proper geometry object.
Fix 2
Specify correct SRID
Specify correct SRID
INSERT INTO t (g) VALUES (ST_GeomFromText('POINT(1 1)', 4326));Why this works
MySQL 8.0 enforces SRID on GEOMETRY columns with an SRID attribute.
What not to do
✕
Version notes
Sources
Official documentation ↗
MySQL 8.0 — 1416 ER_CANT_CREATE_GEOMETRY_OBJECT
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev