MySQL JSON functions received an invalid oneOrAll argument; only 'one' or 'all' are allowed.
ER_JSON_BAD_ONE_OR_ALL_ARG occurs when a MySQL JSON function gets an invalid oneOrAll argument. Use the exact string 'one' or 'all' to resolve the error.
ER_JSON_BAD_ONE_OR_ALL_ARG
MySQL error code 3154, condition ER_JSON_BAD_ONE_OR_ALL_ARG, appears when a JSON function receives an invalid oneOrAll argument.
The argument must be the literal string 'one' or 'all'; any other value triggers the 42000 SQL state and stops query execution.
Most cases involve typos, extra spaces, or a variable that evaluates to something other than 'one' or 'all'.
Older client libraries or ORM code that builds dynamic SQL may also supply numeric or NULL values, causing the check added in MySQL 5.7.8 to fail.
Confirm the second argument of functions like JSON_CONTAINS_PATH, JSON_SEARCH, and JSON_REMOVE is hard coded as 'one' or 'all'.
If you need to drive the value dynamically, validate input in application code or with a CASE expression before calling the JSON function.
JSON_CONTAINS_PATH(JSON_OBJECT('a',1,'b',2), 'any', '$.a') fails because 'any' is not accepted.
A stored procedure that passes a user parameter directly can fail when the user enters blank text; coalesce it to 'one' or 'all' first.
Always use lowercase constants 'one' and 'all', and wrap them in single quotes to avoid ambiguity.
Galaxy's editor linting flags invalid literals in JSON functions early, reducing runtime errors in staging and production.
Error 3145 ER_JSON_VALUE_OUT_OF_RANGE arises when JSON numbers exceed the range of DOUBLE.
Error 3146 ER_INVALID_JSON_TEXT means the supplied string is not valid JSON; both can occur alongside 3154 during complex imports.
Spelling the parameter as ONE, One, or any other value instead of lowercase 'one'.
Passing a bind variable that contains an empty string or NULL.
Using a client older than 5.7.8 that interprets the enumeration differently.
Occurs when the supplied string is not valid JSON; often appears during bulk imports.
Raised when a JSON numeric value exceeds the allowed range for DOUBLE.
Signals that a non-JSON-compatible type was supplied to a JSON function.
No. MySQL treats 'ONE' and 'one' the same, but using lowercase avoids confusion.
Yes, but first ensure the column value is either 'one' or 'all' to avoid runtime errors.
No. The specific check and error code are unique to MySQL 5.7.8 and later.
Galaxy's SQL linter flags invalid oneOrAll values while you type, preventing the error before execution.