“File Is Not a Database” SQLite Error: How to Fix It
You try to open a database and SQLite stops you with a blunt message: “file is not a database.” Older versions say “file is encrypted or is not a database.” Either way, nothing opens.
This error has a handful of clear causes. The good news is that you can usually find the right one in under a minute. This guide shows you how to check your file, explains every common cause in plain words, and tells you what you can and can’t fix.
What the error actually means
When SQLite opens a file, it reads the first 100 bytes. This is the database header. It must start with these exact 16 bytes:
SQLite format 3followed by a zero byte. After that come settings like the page size and the file format version.
If the header is missing, damaged, or doesn’t make sense, SQLite refuses to go further. It returns error code 26, called SQLITE_NOTADB, with the message “file is not a database.”
So the error isn’t really about your data. It’s about the first few bytes. Something about them isn’t what SQLite expects.
Step 1: Check the header in seconds
Before guessing, look at the file.
The easy way
Drop the file into our online SQLite viewer. It checks the header before trying to open anything. If the header is wrong, you’ll see a clear message saying the file isn’t a SQLite 3 database. Nothing is uploaded, so it’s safe for private files.
On Mac or Linux
head -c 16 yourfile.db | xxdA good file shows “SQLite format 3.” followed by a dot for the zero byte. You can also run:
file yourfile.dbIt should say “SQLite 3.x database.”
On Windows
Open PowerShell in the file’s folder and run:
Format-Hex .\yourfile.db | Select-Object -First 1Look at the text column on the right. You want to see “SQLite format 3.” If you don’t, the file isn’t a plain SQLite database.
What you see instead tells you a lot. Let’s go through the causes.
Cause 1: The file is encrypted
This is the most common cause by far. Many apps encrypt their databases. The whole file, including the header, looks like random bytes.
Common examples:
- WhatsApp backups ending in .crypt12, .crypt14 or .crypt15
- Signal desktop and mobile databases
- Apps that use SQLCipher, a popular encryption add-on for SQLite
- Password managers and banking apps
How to spot it: the first bytes look like random noise with no readable text at all.
What you can do: you need the encryption key and a tool that supports the same encryption. For SQLCipher, some builds of DB Browser for SQLite can open files if you have the password. For WhatsApp and Signal, the keys are protected by the apps themselves, and a normal viewer can’t read the files. Our guide to WhatsApp msgstore.db explains the details.
Cause 2: The file isn’t SQLite at all
Not every .db file is SQLite. Some examples:
- Thumbs.db on Windows is a thumbnail cache in a different format.
- Old desktop databases like Paradox or dBase use their own formats.
- App-specific formats that just happen to use a .db extension.
How to spot it: the header shows something else, or the file command names a different format.
What you can do: find out which program created the file and use that. Our guide on what a .db file is covers the most common formats.
Cause 3: The file is compressed or zipped
Backups and downloads are often compressed. A zipped database won’t open until you extract it.
How to spot it:
- Zip files start with the letters “PK.”
- Gzip files start with the bytes 1F 8B.
- Anki’s .apkg files are zip archives with a database inside.
What you can do: rename the file to .zip (or .gz), extract it, and open the file inside.
Cause 4: The download or copy didn’t finish
A partial download or an interrupted copy can leave you with a file that’s cut short or filled with zeros.
How to spot it:
- The file is much smaller than expected.
- The file is 0 bytes.
- The first bytes are all zeros.
What you can do: copy or download the file again. Compare its size with the original.
Cause 5: It’s a cloud placeholder
OneDrive, iCloud Drive, Google Drive and Dropbox can show files that aren’t actually on your computer yet. When you copy one of these placeholders, you may get an empty or partial file.
What you can do: make the file available offline first. In OneDrive, right-click and choose Always keep on this device. In iCloud, click the download icon. Then copy it again.
Cause 6: It’s a Git LFS pointer
If you got the database from a Git repository that uses Git LFS, you might have a tiny text file instead of the real database. Open it in a text editor. If it starts with “version https://git-lfs.github.com,” it’s a pointer.
What you can do: run git lfs pull in the repository to download the real file.
Cause 7: You opened the wrong file
It’s easy to grab the wrong file from a folder that holds several related ones:
mydata.db-walis the write-ahead log, not the database.mydata.db-shmis shared memory, not the database.mydata.db-journalis a rollback journal, not the database.
What you can do: open the main file, the one without the extra ending. Keep the side files in the same folder so SQLite can use them. Our guide to how to open a SQLite file explains which file to pick.
Cause 8: The header is damaged
Sometimes the file is genuinely corrupted. Disk errors, crashes during writes, or buggy tools can damage the header or other pages.
How to spot it: the header starts correctly but other fields are nonsense, or SQLite reports “database disk image is malformed” on some queries.
What you can do: first, try a backup. If you don’t have one, follow our guide to repairing a corrupted SQLite database. The sqlite3 command line has a .recover command that can often rescue most of the data.
Cause 9: A very old SQLite version
Files that use WAL mode set a format number in the header that SQLite versions older than 3.7.0 don’t understand. Those versions report the file as encrypted or not a database. This is rare today, but it can happen with ancient tools or embedded systems.
What you can do: use a modern tool. Our browser viewer runs a recent SQLite build, so it opens WAL-mode files without trouble.
A real example: a WhatsApp backup
Here’s a case we see all the time. Someone copies msgstore.db.crypt14 from their phone, renames it to msgstore.db, and tries to open it. They get “file is not a database.”
Checking the header shows random bytes with no readable text. That points straight to encryption. Renaming didn’t change the contents, so the file is still encrypted. The fix isn’t a better viewer. It’s getting an unencrypted copy of the database, which only WhatsApp itself can produce. Knowing this saves hours of trying different tools.
The same logic applies to any file. Look at the header first, then pick the fix. Don’t guess.
Quick diagnosis table
| What you see at the start of the file | Likely cause | Fix |
|---|---|---|
| “SQLite format 3” | Header is fine. Check for corruption elsewhere. | Try .recover or a backup |
| Random bytes, no text | Encrypted | Need the key and a compatible tool |
| “PK” | Zip archive | Extract it first |
| All zeros | Incomplete copy or cloud placeholder | Copy again after a full download |
| “version https://git-lfs” | Git LFS pointer | Run git lfs pull |
| Other readable text | Different file format | Use the app that made it |
How to avoid this error in future
- Copy databases with the app closed. This avoids partial writes.
- Keep the side files together. Move -wal and -shm files with the database.
- Check file sizes after copying. A big difference means something went wrong.
- Make cloud files available offline before copying.
- Keep backups. A backup is the only guaranteed fix for real corruption.
Want the technical detail? See the official SQLite result and error codes list.
Frequently asked questions
Can I force SQLite to open a file that isn’t a database?
No. If the header is missing, SQLite has no way to understand the rest of the file. You need to find out what the file really is.
Does renaming the file help?
No. SQLite ignores the extension. Renaming a file from .crypt14 to .db doesn’t remove the encryption.
Is my data lost?
Not necessarily. Encrypted files are fine, just locked. Zipped files just need extracting. Only real corruption risks data loss, and even then recovery often works.
Why does it say “file is encrypted or is not a database”?
That’s the older wording of the same error. Newer SQLite versions just say “file is not a database.”
Summary
“File is not a database” means SQLite couldn’t recognise the file’s header. Check the first bytes with our free online SQLite viewer or a quick command. Then match what you see to the cause: encryption, a different format, compression, an incomplete copy, a cloud placeholder, the wrong file, or real corruption. Most cases take a minute to fix once you know which one you have.







