How to Fix MySQL Error 3153 (ER_JSON_VACUOUS_PATH)
You get mysql error 3153 when a query passes a root path to a JSON function. You fix it by pointing the path to a specific child key or array item. MySQL logs this issue under the symbol ER_JSON_VACUOUS_PATH and uses the SQLSTATE code 42000. The database returns the message that the path expression '$' is not allowed in this context. This rule stops a query from deleting or changing an entire JSON document by mistake. When a function expects a nested element, the lone dollar sign is too broad.
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 get mysql error 3153 when a query passes a root path to a JSON function. You fix it by pointing the path to a specific child key or array item.
MySQL logs this issue under the symbol ER_JSON_VACUOUS_PATH and uses the SQLSTATE code 42000. The database returns the message that the path expression '$' is not allowed in this context. This rule stops a query from deleting or changing an entire JSON document by mistake. When a function expects a nested element, the lone dollar sign is too broad.
What causes mysql error 3153 in the database engine
Every JSON path in MySQL starts with a dollar sign to mark the document root. Most read functions let you grab the whole document with that single root symbol. Still, write functions that remove or shift inner keys need a deeper target path. If you tell the engine to remove the root path, the result is not valid JSON.
The parser checks your path string before it changes any row on disk. When it sees a bare root path in a restricted function, it stops the query right away. This check protects your stored objects from turning into empty or broken records.
Dynamic queries in backend apps trigger this error very often. An app might build a JSON path string from user input or a blank variable. If the variable is empty, the app sends only the dollar sign to the database. The engine rejects the statement and sends back code 3153 to the client.
How to find and fix the failure in production
Start by checking your app logs to find the exact query that failed. Look at every JSON function call in that statement and inspect the path arguments. You will spot either a hardcoded dollar sign or a dynamic variable that resolved to nothing.
Next, decide what the query was trying to do to the data. If the goal is to delete one field inside the JSON column, add the key name. If the goal is to wipe out the whole JSON column, use a normal update statement. Set the column to an empty JSON object or a null value instead.
JSON Web Tokens (JWT) + MySQL Access Governance: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Add input checks in your app code before sending queries to the database. Make sure your code never builds a path string that holds only the root symbol. If a key name variable is blank, stop the action in the app layer first.
Safe ways to test JSON fixes on live data
Never test path changes with broad admin accounts on a live database. Use a read-only role to inspect the current JSON structure in your tables first. When you run a test read, data masking rewrites matched fields like emails or phone numbers in results. It also rewrites card numbers and national IDs so sensitive values stay safe during checks.
Once you know the exact key names, test your updated query in a staging setup. Check that the path points to a real child node and runs without errors. After the test passes, ship the fix through your normal code review flow. Keep database roles tight so no user or app can run ad-hoc updates on raw tables.
Inspect every MySQL query and response in flight
Static grants and network rules block bad logins. They cannot pause a risky query for review or mask emails in a result set. By design, hoop.dev sits inline in the MySQL protocol as a sidecar for your MySQL. For every plain query, prepared statement, or cursor an agent or human runs in production, hoop.dev decides to pass, mask, block, or hold it for review.
First, hoop.dev guardrails block banned actions before MySQL runs them, and an AI Analyzer you configure can score intent or escalate for approval. Next, hoop.dev data masking rewrites sensitive string columns in results in memory, and every verdict goes to the audit trail. Find the open-source binary on GitHub.
Frequently asked questions
What does the ER_JSON_VACUOUS_PATH symbol mean in MySQL?
It means your query used a bare root path in a JSON function that needs a specific child key. MySQL blocks the query because the root path alone is too vague for that action.
How do I clear a whole JSON column without getting error 3153?
Do not use a JSON path function to remove the root document. Run a standard update query and set the column value to an empty object or null.
Why does my app trigger code 3153 only for some users?
Your app likely builds the JSON path from a variable that is blank for those users. When the key name is missing, the path string drops down to a lone dollar sign.
Related guides
In this post