Common SQL Errors

MySQL Error 3153: ER_JSON_VACUOUS_PATH - How to Fix and Prevent

Galaxy Team
August 8, 2025

MySQL raises ER_JSON_VACUOUS_PATH (error 3153) when the JSON path expression is a lone $ symbol, which is disallowed outside SELECT projections.

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is MySQL error 3153 ER_JSON_VACUOUS_PATH?

ER_JSON_VACUOUS_PATH (MySQL error 3153) means the JSON path '$' is used where MySQL expects a more specific path. Replace '$' with a valid key or array step, or omit JSON_EXTRACT entirely to fix the issue.

Error Highlights

Typical Error Message

ER_JSON_VACUOUS_PATH

Error Type

Syntax Error

Language

MySQL

Symbol

ER_JSON_VACUOUS_PATH was added in 5.7.8.

Error Code

3153

SQL State

42000

Explanation

Table of Contents

What is MySQL error 3153 ER_JSON_VACUOUS_PATH?

MySQL raises ER_JSON_VACUOUS_PATH when a JSON function receives the bare dollar sign path ( $ ) where a more detailed path is required. The server labels this shorthand as vacuous, meaning it carries no actionable navigation.

The error first appeared in MySQL 5.7.8 and commonly surfaces in JSON_EXTRACT, JSON_SET, JSON_REMOVE, or CHECK constraints that reference JSON columns.

What Causes This Error?

The primary trigger is using '$' on its own inside JSON path arguments. MySQL expects at least one key, array index, or wildcard after the root token when the path sits in a WHERE clause, UPDATE assignment, or constraint.

It can also occur when a generated column or view definition includes JSON_EXTRACT(col, '$') instead of selecting the column directly.

How to Fix ER_JSON_VACUOUS_PATH

Identify every JSON function call that passes '$'. Decide whether you truly need JSON_EXTRACT. If you intended to return the whole document, drop the function and reference the column name directly.

If you meant to fetch a key, change '$' to '$.key_name' or '$[index]'. Validate path syntax with JSON_VALID before deploying.

Common Scenarios and Solutions

CHECK constraint failure - Replace JSON_EXTRACT(data,'$') IS NOT NULL with data IS NOT NULL.

WHERE filter typo - Change WHERE JSON_EXTRACT(meta,'$') = 1 to WHERE meta = 1 or WHERE JSON_EXTRACT(meta,'$.flag') = 1.

UPDATE misuse - Switch JSON_SET(info,'$','value') to JSON_SET(info,'$.field','value').

Best Practices to Avoid This Error

Always include a key or array step after '$' when you need partial extraction. Lint new SQL with automated tests that reject vacuous paths.

Store entire JSON blobs only when necessary; prefer normalized columns for frequently accessed fields to reduce JSON_EXTRACT usage.

Related Errors and Solutions

Error 3143 ER_INVALID_JSON_PATH - Raised for syntactically invalid paths. Fix by following MySQL JSON path grammar.

Error 3144 ER_INVALID_WINDOWING_EXPRESSION - Unrelated to JSON but often seen in the same complex queries. Review window clauses for frame errors.

Common Causes

Common Causes

Using JSON_EXTRACT(col,'$') in SELECT, WHERE, or CHECK clauses.

Passing '$' to JSON_SET, JSON_INSERT, or JSON_REMOVE during UPDATE statements.

Copying example code that assumes other databases allow the root token alone.

Related Errors

Related Errors

ER_INVALID_JSON_PATH (3143) - Path syntax error, not just vacuous.

ER_INVALID_JSON_CHARSET (3146) - JSON column with non-utf8 character set.

ER_JSON_DOCUMENT_NULL_KEY (3152) - Attempt to use NULL as path key.

FAQs

Why does '$' work in SELECT but not in WHERE?

Inside SELECT, '$' simply returns the full JSON and is allowed. In WHERE and other expressions MySQL needs a scalar value, so a bare path causes ER_JSON_VACUOUS_PATH.

Does this error affect MariaDB?

MariaDB implements JSON differently and may allow '$' in places where MySQL rejects it, so confirm against your version.

Will upgrading MySQL remove the error?

No. The restriction exists in all versions since 5.7.8. Rewrite queries instead of relying on an upgrade.

How can Galaxy help me avoid this?

Galaxy highlights JSON path misuse during query linting and suggests valid paths through its AI copilot, reducing runtime errors.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo