SQLITE_TOOBIG: string or blob too big
A string, BLOB or SQL statement was larger than SQLite's limit, 1,000,000,000 bytes by default, or a lower limit set by the application.
- Result code
SQLITE_TOOBIG- Name
18- Category
- Primary result codes
What it means
SQLITE_TOOBIG (18) is returned when a string or BLOB exceeds the maximum length, set at compile time with SQLITE_MAX_LENGTH (default 1,000,000,000 bytes) or lowered at run time with sqlite3_limit(db, SQLITE_LIMIT_LENGTH, ...). An oversized SQL statement gets the same error; its limit is SQLITE_MAX_SQL_LENGTH / SQLITE_LIMIT_SQL_LENGTH. A row larger than the length limit also fails.
Common causes
- Storing a very large file or document in a single BLOB or TEXT value.
- Building one huge SQL statement, such as a multi-row
INSERTwith millions of literal values. - An application or binding that lowered the limit with
sqlite3_limit(). - A
group_concat()or string concatenation that grows past the limit.
How to fix it
-
Store large files outside the database and keep their paths, or split the content into chunks across rows.
-
Insert many rows with one prepared statement executed repeatedly, with bound parameters, instead of a single enormous statement.
INSERT INTO items (id, name) VALUES (?, ?); -- prepare once, bind and run per row
-
Check whether your binding sets a lower length limit, and raise it if appropriate.
Related errors
SQLITE_RANGEcolumn index out of range8152SQL Server: String or binary data truncated1153MySQL: Got a packet bigger than max_allowed_packet
More primary result codes errors
SQLITE_ERRORSQL logic errorSQLITE_PERMaccess permission deniedSQLITE_ABORTquery abortedSQLITE_BUSYdatabase is lockedSQLITE_LOCKEDdatabase table is lockedSQLITE_NOMEMout of memorySQLITE_READONLYattempt to write a readonly databaseSQLITE_INTERRUPTinterrupted
The code and message text are from the SQLite result and error codes documentation. Browse the full SQLite error list or search every database error.
Work on SQLite in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for SQLite and the other databases you use.