Troubleshooting

MySQL error numbers returned by Raft DB

A table of the MySQL error numbers the SQL front-end returns most often, with the SQLSTATE, the usual text, the cause in Raft DB and what to do.

The SQL front-end answers with MySQL's error numbers, SQLSTATE codes and message texts, because drivers and tools read them (the numbers are listed here by how often the code raises them and how often users meet them). Errors and their texts are compared with a real MySQL 9.7 and MariaDB 11.4; the wording of a few differs between the dialects.

Connection and login#

No.SQLSTATETextCause hereFix
104008004Too many connectionsmax_connections reachedRaise it; close idle connections.
104308S01Bad handshakeThe first packet from the client was not a valid loginNot a MySQL client, or a proxy that changed the packet.
104528000Login refused for user 'u'@'host' (password supplied: YES|NO)Unknown user, wrong password, or an account whose host does not matchConnection problems.
104708S01Unknown commandThe client sent a command code the front-end does not knowReport with the client and version.
2013HY000Lost connection to Raft DB: ...Two-process mode: the link to raftdb-server brokeCheck raftdb-server.

Databases and tables#

No.SQLSTATETextCause hereFix
10463D000No database selectedA statement needs a database and none was chosenUSE db.
104942000Unknown database 'x'The database does not exist or is not this front-end'sSHOW DATABASES.
1007HY000Can't create database 'x'; database existsCREATE DATABASE IF NOT EXISTS.
105042S01Table 'x' already existsAlso a view or a hidden nameIF NOT EXISTS, or drop it.
105142S02Unknown table 'x'DROP TABLE of a missing table (or of a view)IF EXISTS.
114642S02The table 'db.t' was not foundMissing, mistyped, or wrong database. Also "The table's storage is missing" when the definition exists but Raft DB has no tableSQL problems.
110342000Incorrect table name 'x'A name the front-end keeps for itself, or one MySQL refusesRename.
1347HY000'db.v' is not BASE TABLEA table statement on a viewUse the right statement.
1288HY000The table v targeted by the UPDATE cannot be modifiedA write to a grouped or otherwise non-updatable viewWrite to the table.
1471HY000The INSERT cannot target v, which does not accept inserted rowsSameWrite to the table.
1356HY000View references invalid table(s) or column(s) ...The view's source changedRe-create the view.
1462HY000db.v contains view recursionViews nested over 16 levelsSimplify.

Columns, keys and definitions#

No.SQLSTATETextCause hereFix
105442S22Unknown column 'c' in 'where clause' (or the clause named)A column that does not exist; also a hidden function-index columnCheck spelling and aliases.
105223000The column name 'c' in field list could refer to more than one tableThe name exists in two joined tablesQualify it.
106042S21Duplicate column name 'c'CREATE/ALTER TABLE
106142000Duplicate key name 'k'
106842000More than one primary key was defined
107242000Column 'c' named in the key is not in the table
107542000The table definition is wrong: a single auto column is allowed, and it has to be a key
106742000The default value given for 'c' is not valid
109142000DROP of 'x' failed; the column or key may not exist
117642000No key called 'k' can be found in table 't'An index hint or DROP INDEX names a missing key
142642000Precision given for 'c' is too big; the largest allowed is 65DECIMAL(p,...) with p above 65
3105HY000The value specified for generated column 'c' in table 't' is not allowedA value given for a generated columnUse DEFAULT.
3819HY000Check constraint is violatedA CHECK failed
4028HY000A table must have at least one visible columnAll columns invisible
3753, 375742000, HY000Cannot create a functional index on ... JSON/GEOMETRY / BLOB or TEXTUse CAST.
3008HY000Foreign key cascade delete/update exceeds max depth of 15A cascade chain too deep
1822HY000Failed to add the foreign key constraint. Missing index for constraint ...The referenced table has no index on the keyAdd the index.

Data#

No.SQLSTATETextCause hereFix
104823000A NULL value cannot be stored in column 'c'NULL into a NOT NULL column (also in a multi-row insert: the whole statement fails)
106223000The value 'v' is already present for key 'k'Primary key or unique index. MySQL words the key 'table.k', MariaDB 'k'. Text compares without case
113621S01The number of values at row N does not equal the number of columns
126422003The value for column 'c' (row N) is outside the allowed rangeStrict modeWiden the column or fix the value.
126501000The value stored in column 'c' (row N) was cut off
129222007Incorrect date/time/number value for column 'c' at row N
1364HY000No default value is defined for field 'c'A NOT NULL column with no default left out
1366HY000The integer value 'v' given for column 'c' (row N) is not valid (and the same for other types)A value of the wrong type; also a statement that is not valid UTF-8
140622001The value for column 'c' (row N) is too long
145123000Deleting or updating the parent row would violate a foreign key constraintA child row existsDelete children, or declare ON DELETE CASCADE.
145223000Adding or updating the child row would violate a foreign key constraintNo parent row
314022032Invalid JSON text: "..." at position N in value for column 't.c'A document that is not JSON
314122032The JSON text given as argument N of function f is invalid

Statements, functions and expressions#

No.SQLSTATETextCause hereFix
123542000This version of the Raft DB MySQL front-end doesn't yet support 'X'Valid MySQL that Raft DB has not builtWhat is not there yet.
106442000Syntax error in the SQL statement; ... Error near '...' at line NA syntax error (the text gives the place); also in CHECK and functional key parts
106542000Query was empty
1105HY000Raft DB: ... (or another unknown error text)A refusal by Raft DB that has no MySQL equivalent, passed on with its message; also "could not claim a unique value" and "the definition of table 't' is damaged"; a statement on a bootstrap administrator (see below)Read the text after Raft DB:.
1111HY000A group function is used where it is not allowedAn aggregate where it is not allowed
1210HY000Incorrect arguments to f
122221000The SELECT statements being combined return different numbers of columnsUNION branches differ
130542000FUNCTION f is unknownAn unknown function (many MySQL functions exist; some do not)Check the function list.
131770100The query was interruptedA stored routine that ran more than 50 million statements and loop turns was stopped
1193HY000Unknown system variable 'x'SET of a variable that does not existSystem variables.
1243HY000Prepared statement handler (N) is unknown to mysqld_stmt_execute
146142000Can't create more than max_prepared_stmt_count statements16,382 per session

Routines, triggers, sequences#

No.TextCause
1318Incorrect number of arguments for PROCEDURE db.pCALL with the wrong count
1324Undefined CURSOR: c
1329No data: no row was fetched, chosen or handledA FETCH past the end with no handler
1308LEAVE with no matching label
1359, 1360Trigger already exists / does not exist
1442Can't update table 't' in stored function/trigger because it is already used by statement which invoked this stored function/triggerA trigger changing its own table
1456Routine r went past its recursion limit of 0, which comes from the max_sp_recursion_depth variable
4084Sequence 'db.s' is exhaustedNEXTVAL past MAXVALUE without CYCLE (MariaDB dialect)
4085Sequence 'db.s' has option values outside the permitted range
4091Unknown SEQUENCE: 's'

Privileges and accounts#

No.SQLSTATETextCause here
104442000User 'u'@'h' is not allowed to use database 'd'No privilege on the database
114242000cmd is not permitted for user 'u' on table 't'
114342000cmd is not permitted for user 'u' on column 'c' of table 't'
122742000Access denied; you need (at least one of) the SUPER ... privilege(s)SET GLOBAL without SUPER
1396HY000Operation CREATE USER failed for 'u'@'h'The account exists (or does not, for DROP/ALTER)
1105HY000the password of an account named in the connector's configuration is set thereSET PASSWORD or ALTER USER on a bootstrap administrator
1105HY000an account named in the connector's configuration already has every privilegeGRANT to a bootstrap administrator

Other numbers in the privilege family (1141, 1147, 1133, 1410, 1221, 1144, 1827) are explained in Privileges.

Errors from raftdb-server, not MySQL numbers#

WhereCodeMeaning
Binary protocol11 FORBIDDENRole or database scope refuses the request
Binary protocol12 READ_ONLYA replica or a managed node that is not the primary
Binary protocol13 TOO_BIGA UDP reply that does not fit a datagram
HTTP401 unauthenticated, 403 forbidden, 403 read_only_replica, 409 not_leader, 409 conflict, 400 confirm_requiredSee HTTP administration API

When a refusal from raftdb-server reaches a MySQL client through the HTTP link it is translated: 404 becomes 1049, 409 conflict 1007, 403 1044, a broken link 2013, anything else 1105 with Raft DB: message.

See also#