How to Fix MySQL Error 3737 (ER_SRS_INVALID_SEMI_MAJOR_AXIS)
You see mysql error 3737 when a spatial reference system has a bad axis length. You fix it by setting the semi-major axis to a positive number above zero. MySQL maps this failure to symbol ER_SRS_INVALID_SEMI_MAJOR_AXIS and SQLSTATE SR002. The database rejects your spatial system statement before it saves any bad map rules. Spatial math needs a valid globe size to calculate distance and area values. If the axis is zero or less, every map query will fail. What causes mysql error 3737 in your d
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You see mysql error 3737 when a spatial reference system has a bad axis length. You fix it by setting the semi-major axis to a positive number above zero.
MySQL maps this failure to symbol ER_SRS_INVALID_SEMI_MAJOR_AXIS and SQLSTATE SR002. The database rejects your spatial system statement before it saves any bad map rules. Spatial math needs a valid globe size to calculate distance and area values. If the axis is zero or less, every map query will fail.
What causes mysql error 3737 in your database
MySQL stores map projections and coordinate systems in a spatial reference table. Each entry defines an ellipsoid model of the Earth or another body. That model uses a semi-major axis to set the radius at the equator. The official message states the length of the semi-major axis must be positive.
This error happens when a user or migration script adds or changes a custom system. A typo in the text definition often sets the axis value to zero. In other cases, a script passes a negative number or an empty variable. Third-party map tools can also generate broken strings when they export custom grids.
When the engine parses the definition string, it checks the spheroid numbers right away. If the first number in the spheroid block is zero or negative, execution stops. The engine returns SQLSTATE SR002 and rolls back the statement to protect existing data.
How to diagnose the broken spatial definition
Start by finding the exact statement that triggered the failure in your database logs. Look for statements that create or replace a spatial reference system in the catalog. Check the text string that defines the datum and the spheroid values.
In standard spatial text formats, the spheroid block holds a name and two numbers. The first number is the semi-major axis length, measured in the base unit. The second number is the inverse flattening value for the shape of the globe. Verify that the first number is present and greater than zero.
MySQL Access Governance + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
If a deployment tool ran the query, check the source variables in your repo. Many teams store map strings in text files or app settings. An unet variable can default to zero during a build step. Compare your custom string against official EPSG registry standards to find the right radius.
How to fix the semi-major axis safely in production
Once you have the right positive number, update your migration script with the fix. For Earth grids in meters, this value is usually around six million. Test the updated statement in a staging database before you touch production.
Changing spatial catalog entries requires high privileges in a MySQL database. Do not grant permanent admin roles to engineers or apps to run this fix. Instead, review the spatial statement through a peer check workflow first.
Run the corrected statement through a controlled session with full audit logs turned on. If your database holds sensitive records like emails or phone numbers, keep data masking active. Masking rewrites matched fields in results while the engineer checks the spatial catalog tables. After the command succeeds, query the information schema view to confirm the new axis length.
Check MySQL queries and results on the wire
MySQL grants control who logs in. They do not check single queries or mask sensitive columns once a session starts. With hoop.dev, you run an open-source proxy, a sidecar for your MySQL, inline in the MySQL wire protocol. On every query an AI agent or human runs against production MySQL, RDS, or Aurora, hoop.dev decides to pass, mask, block, or hold it for review.
Multi-statement batches and prepared queries are split and checked one by one by hoop.dev guardrails, which refuse banned queries with a native MySQL error or hold risky ones for approval. On the response path, hoop.dev data masking rewrites string values in returned rows in memory, and every decision is logged. See the MIT-licensed project on GitHub.
Frequently asked questions
What does SQLSTATE SR002 mean in MySQL?
SQLSTATE SR002 means a spatial reference system definition has an invalid parameter value. For error code 3737, it points to a semi-major axis that is not positive.
Can a normal table insert trigger mysql error 3737?
No, normal row inserts into geometry columns do not trigger this specific error code. It only happens when you create or alter a spatial reference system entry.
How do I find the right semi-major axis value?
Look up your coordinate system code in the official EPSG registry online. Copy the exact spheroid radius number from the standard well-known text definition.
Related guides
In this post