pgref.dev/sqlite/errors/SQLITE_CORRUPT_VTAB
SQLITE_CORRUPT_VTABERRORTier 3 — Handle with care⚠️ MEDIUM confidence

Virtual table content is corrupt

Category: CorruptionVersions: 3.7.15+

🔴 Production Risk Error

High — FTS index may be unusable; rebuild or restore.

What this means

SQLITE_CORRUPT_VTAB (267) is an extended code returned by virtual table implementations when they detect internal corruption in their data store — not in the SQLite B-tree but in the virtual table's own storage.

Why it happens

  1. 1FTS (full-text search) index is inconsistent with the content table.
  2. 2Custom virtual table detected data corruption in its backing store.

How to reproduce

FTS3/FTS4/FTS5 integrity check or operations on a corrupt virtual table.

trigger — this will ERROR
import sqlite3
conn = sqlite3.connect('my.db')
# Check FTS5 integrity:
try:
    conn.execute("INSERT INTO my_fts(my_fts) VALUES('integrity-check')")
except sqlite3.DatabaseError as e:
    print(e)  # database disk image is malformed
sqlite3.DatabaseError: database disk image is malformed

Fix 1

Why this works

For FTS tables, run: INSERT INTO fts_table(fts_table) VALUES('rebuild')

Fix 2

Why this works

Check the main database integrity: PRAGMA integrity_check;

Fix 3

Why this works

Restore from backup if rebuild fails.

Sources

📚 Official docs: https://www.sqlite.org/rescode.html#corrupt_vtab

🔧 Source ref: sqlite3.h — SQLITE_CORRUPT_VTAB = 267

📖 Further reading: FTS5 integrity check

Confidence assessment

⚠️ MEDIUM confidence

Stable.

See also

📄 Reference pages

FTS5
⚙️ This error reference was generated with AI assistance and reviewed for accuracy. Examples are provided to illustrate common scenarios and may not cover every case. Always test fixes in a development environment before applying to production. Spotted an error? Suggest a correction →