- Rebuild metadata.db safely from calibre's surviving OPF backups and book folders.
- Identify wrong paths, permissions, cloud conflicts, locks, and damaged storage.
- Test recovery on a complete copy before modifying your original library.
- What Does metadata.db Do in a calibre Library?
- Confirm the Symptom With a Small Safe Test
- Protect the Library Before Attempting Recovery
- Restore the Database From calibre's Book Folders
- Check Permissions, Locks, Cloud Sync, and Storage
- Use Logs and Library Checks When Recovery Fails
- Run a Clean Temporary Test Before Reinstalling
- Quick Fix Checklist
- FAQ
If calibre opens to an empty library, reports that metadata.db is missing, or cannot read the database, do not delete or reorganize your book folders. Your e-books may still be intact. The most likely causes are that calibre opened the wrong library location, the database was deleted or damaged, another process locked the file, or cloud synchronization left the library in an inconsistent state. The safest approach is to identify the correct library, make a complete copy, and test calibre's database restoration tools on that copy.

Start with free Canva bundles
Browse the freebies page to claim ready-to-use Canva bundles, then get 25% off your first premium bundle after you sign up.
Free to claim. Canva-ready. Instant access.
1. What Does metadata.db Do in a calibre Library?
The metadata.db file is the central database for a calibre library. It stores the information calibre needs to display, search, sort, and manage the library, including titles, authors, tags, ratings, identifiers, custom columns, and links between book records and files.
A typical library has metadata.db at its top level. Beneath it are author folders, title folders, and the files belonging to each book. A simplified library might look like this:
Calibre Library/
metadata.db
Jane Austen/
Pride and Prejudice (42)/
Pride and Prejudice - Jane Austen.epub
cover.jpg
metadata.opf
George Orwell/
1984 (87)/
1984 - George Orwell.epub
cover.jpg
metadata.opfThe number in parentheses is calibre's internal book ID. Folder and file names are useful for recognition, but they are not a substitute for the database. calibre expects to manage this structure itself.
The important recovery detail is that calibre normally stores an individual metadata.opf backup inside each book folder. When the main database is missing or damaged, calibre can use these OPF files and the existing directory structure to reconstruct much of the library.
Some data may not survive a complete database rebuild. Saved searches, user categories, plugboards, stored per-book conversion settings, and custom news recipes may depend on the original database or configuration. Recovery is therefore intended to restore the useful library catalog, not necessarily every preference exactly as it existed.
2. Confirm the Symptom With a Small Safe Test
2.1 Determine whether calibre opened the wrong library
An empty book list does not automatically mean that the database was deleted. calibre may have opened a new, empty folder after an external drive changed letters, a library was moved, a network location became unavailable, or a cloud provider changed a local path.
- Open calibre and note the library name or location shown in the interface.
- Open the Library menu and choose the option to switch or create a library.
- Browse to the folder that contains your author and book directories.
- Check whether that folder contains
metadata.dbor numerousmetadata.opffiles. - Select the folder as an existing library rather than creating a new library inside it.
Success looks like this: your books reappear immediately after switching to the correct folder. If they do, stop troubleshooting. Do not run database restoration merely because calibre previously opened the wrong location.
2.2 Search for other copies of metadata.db
If you are unsure where the original library is located, search your computer and attached drives for metadata.db. Multiple results may indicate that you have several libraries, an old backup, or a partially synchronized duplicate.
Inspect the surrounding folders rather than choosing the newest database automatically. The correct location should also contain recognizable author folders and book files. On Windows, confirm the full path and drive letter. On macOS and Linux, check whether an external volume is mounted at its usual path.
2.3 Verify that the book files still exist
Open several author and title folders using the operating system's file manager. Confirm that EPUB, PDF, AZW3, MOBI, DOCX, or other expected formats are present. Also look for metadata.opf and cover.jpg.
If book files and OPF files remain, the library is usually a strong candidate for database reconstruction. If the folders are empty or missing, database restoration cannot recreate the actual e-book files. In that situation, recover the complete library from a backup, deleted-file recovery system, cloud version history, or another computer before proceeding.
3. Protect the Library Before Attempting Recovery
3.1 Close every calibre process
Exit the calibre desktop application, E-book viewer, editor, Content server, and any command-line tools using the library. If the application previously crashed, verify through Task Manager, Activity Monitor, or your Linux process monitor that no calibre process remains active.
This matters because two processes trying to use or replace the same database can produce locking errors or interfere with recovery. If the Content server runs automatically, stop it temporarily.
3.2 Copy the complete library folder
Make a copy of the entire library, including metadata.db, author folders, hidden files, OPF files, covers, and book formats. Do not copy only the database.
Name the copy clearly, such as Calibre Library Recovery Copy. If possible, put it on a local internal drive with enough free space. Wait for the copy operation to finish before opening it in calibre.
If the original library is in Dropbox, OneDrive, iCloud Drive, Google Drive, a NAS, or another synchronized location, pause synchronization before copying. Confirm that files are stored locally rather than represented by online-only placeholders.
Success looks like this: the recovery copy contains approximately the same number of folders and files as the source, and you can open several book files directly. Once you have a verified copy, perform potentially destructive recovery steps only on that copy.
3.3 Preserve a damaged database instead of deleting it
If metadata.db exists but calibre cannot open it, leave the original untouched. A damaged database may still be useful for advanced recovery or comparison. Work on a duplicate and, if necessary, rename the duplicate database to something recognizable such as metadata.db.damaged.
Do not manually create an empty file named metadata.db. A filename alone is not a valid calibre database.

4. Restore the Database From calibre's Book Folders
4.1 Use Library Maintenance and Restore Database
calibre's built-in restoration function is the preferred fix when metadata.db was deleted or corrupted but the author and book folders remain.
- Open calibre without modifying the original library.
- Use Switch/create library to open the recovery copy as an existing library.
- Open the Library menu.
- Select Library maintenance.
- Select Restore database.
- Read the warning and confirm that you are operating on the recovery copy.
- Allow the scan and rebuild to finish without moving folders or restarting the computer.
The restoration process reads the metadata backups found in individual book folders and rebuilds the central database. Large libraries may take time, especially on slower storage.
Success looks like this: calibre opens the reconstructed library and displays the expected books. Search for several known titles, open a few records, and confirm that their formats and covers are attached. If the library is usable and the sample books open correctly, stop changing recovery settings and move to verification and backup.
4.2 Understand what book folders can reconstruct
The recovery quality depends on what remains in each folder. A valid metadata.opf can preserve title, author, identifiers, tags, comments, series information, and other catalog metadata available when the backup was written. The e-book files provide the actual reading content and may contain embedded metadata of their own.
Recovery may be incomplete when OPF files are missing, outdated, malformed, or replaced by cloud-sync conflicts. Metadata embedded inside EPUB and other formats can sometimes help when re-adding files, but it may differ from the metadata previously stored in calibre. PDF metadata is often especially limited or inconsistent.
Do not expect folder names alone to reproduce every field. They generally provide clues about author, title, and ID, while the OPF backup supplies the richer record.
4.3 Use the command line only when the interface is unavailable
Experienced users can use calibredb restore_database against a recovery copy. The command requires the explicit confirmation option documented by calibre because it completely regenerates the database.
calibredb restore_database --really-do-it --with-library "/path/to/Calibre Library Recovery Copy"Paths containing spaces must be quoted. On macOS, calibre's command-line programs are normally located inside the application bundle, so you may need to invoke calibredb using its full path.
The command-line method does not create a better reconstruction than the graphical restoration feature. Use it when the interface cannot complete the operation, when you need terminal output, or when you are already comfortable verifying command paths. Never experiment with an unverified path to your only copy.
5. Check Permissions, Locks, Cloud Sync, and Storage
5.1 Test whether calibre can write to the library
A database may appear missing or unusable when the current account cannot read or write the library folder. Check the folder's properties or permissions and verify that your user account has normal read and write access.
- Windows: check folder security permissions, Controlled Folder Access, antivirus quarantine, and whether the library is inside another user's profile.
- macOS: check Sharing and Permissions, privacy controls, external-volume access, and whether files are fully downloaded from iCloud.
- Linux: check the owner, group, write bits, mount options, and whether the filesystem became read-only after an error.
A simple test is to create and delete a harmless text file at the top level of the recovery copy while calibre is closed. If the operating system refuses, correct the ownership, permission, or storage problem before restoring the database.
Success looks like this: your account can create, rename, and delete a test file in the recovery copy, and calibre can open the rebuilt database without a permission or read-only error.
5.2 Eliminate database locks
If calibre says the database is locked, first close other calibre windows and stop the Content server. Then restart the computer if you cannot identify the process holding the file. A restart is more reliable than deleting unfamiliar lock-related files.
Also check backup programs, file indexers, security software, and synchronization clients. Briefly pausing one of these programs can help identify interference, but restore normal protection after the test. Add an antivirus exclusion only when logs clearly show a false positive and you trust the library's contents.
5.3 Move the active test away from cloud and network storage
Cloud synchronization can upload one part of a database transaction while another part is still changing. Concurrent edits from two computers can also create conflicted copies or roll back a good file. Network shares and NAS filesystems may not provide the locking behavior calibre expects.
For a clean test, copy the entire library to a normal local folder, pause sync, and restore the database there. Do not open the same active library from two computers.
If local recovery works, the evidence points to the original storage arrangement rather than the books or calibre installation. Keep the active library on local storage and use a closed, consistent copy for backup or synchronization.
5.4 Check external drives and USB storage
If the library is on an external disk, verify that the operating system mounted the correct volume and that it is writable. On Windows, a changed drive letter can make calibre open a different location. On macOS or Linux, a mount-point change can have the same effect.
Connect the drive directly rather than through an unreliable hub, then copy the library to internal storage before rebuilding. A device used as an e-reader is not a suitable location for the primary calibre library. USB file-transfer modes used by reading devices do not behave like dependable desktop filesystems.
6. Use Logs and Library Checks When Recovery Fails
6.1 Read the exact error instead of repeating restoration
If restoration stops, record the full message. Look for references to permission denial, malformed paths, unreadable OPF files, missing formats, disk space, input/output errors, or database locking. These descriptions indicate different fixes.
For example, a permission error calls for access correction, while an input/output error may indicate failing storage. Repeating the same restore operation is unlikely to help until the underlying condition changes.
6.2 Run Check Library after successful reconstruction
After the database opens, use Library maintenance and Check library to compare database records with the files on disk. Review reported missing formats, extra files, invalid folders, or unmatched book directories carefully.
Do not accept bulk deletion or automatic changes without understanding the report. Extra files may be legitimate documents you want to preserve, while missing formats may point to an incomplete backup.
Success looks like this: calibre recognizes the expected books and formats, and any remaining discrepancies are limited, understood, and backed up.
6.3 Start calibre with debugging enabled
If the graphical interface closes unexpectedly or gives an unhelpful error, start the GUI from a terminal or command prompt with debugging enabled:
calibre-debug -gReproduce the problem once and inspect the terminal output. Look near the end for the first meaningful database, filesystem, permission, plugin, or path error. You can also use calibre's graphical debug-log option when available.
Debugging is most useful for identifying the failing component. It is not a reason to edit the database manually. Save the output before closing the terminal if you intend to request support.
6.4 Temporarily rule out plugins
A plugin is less likely to delete metadata.db than a storage or synchronization problem, but a failing plugin can make calibre appear not to work after the library opens. If database restoration succeeds but startup or book selection still fails, restart calibre with third-party plugins disabled or temporarily remove the recently changed plugin.
Stop this branch of troubleshooting as soon as calibre behaves normally with the same recovered library. Re-enable plugins individually to identify the conflict instead of changing unrelated conversion, device, email, viewer, or metadata-download settings.
7. Run a Clean Temporary Test Before Reinstalling
Reinstalling calibre normally does not restore a missing library database because the application and the library are separate. Before reinstalling, perform a controlled local test:
- Close calibre and pause cloud synchronization.
- Make a complete copy of the affected library.
- Place the copy in a short, local path owned by your user account.
- Open that folder as an existing library.
- Run Restore database on the copy.
- Check several titles, formats, covers, authors, tags, and series.
- Open a sample of books in the viewer and, if relevant, send one test book to a device.
If this test works, calibre itself is functioning. The original failure is probably connected to the old path, permissions, cloud synchronization, network storage, external media, or file damage at the original location. Reinstalling would add risk without addressing the cause.
If the test fails at the same point, preserve the debug log and inspect the referenced OPF or book folder. One malformed record may be preventing completion. Move only the specifically identified problem folder out of the recovery copy, retry restoration, and add that book back later from its e-book file. Never perform this isolation process on the sole original library.
8. Quick Fix Checklist
- Confirm that calibre is pointed at the correct library folder.
- Search for other copies of
metadata.dbbefore rebuilding anything. - Verify that author folders, title folders, book formats, and OPF files still exist.
- Close calibre, the viewer, editor, command-line tools, and Content server.
- Pause cloud sync and make a complete local copy of the library.
- Do not delete, rename, merge, or reorganize the original book folders.
- Open the copied folder as an existing library.
- Use Library maintenance and Restore database.
- Check operating-system ownership, permissions, free space, and read-only status.
- Use Check library after recovery to identify mismatches.
- Open several books and verify metadata before replacing the damaged library.
- Create a fresh backup of the complete recovered library.
9. FAQ
9.1 Can calibre recover a library without metadata.db?
Yes, if the author and title folders remain and contain usable metadata.opf backups. calibre's Restore database function can reconstruct the central database from those per-book records. The result may not include saved searches, user categories, plugboards, custom recipes, or stored per-book conversion settings.
9.2 Should I delete the book folders and add everything again?
No. Those folders contain the e-books and the metadata backups needed for the best recovery. Deleting or flattening them can turn a database problem into permanent content loss. First copy the complete library and attempt database restoration.
9.3 Can metadata be recovered from the e-book files?
Sometimes. Formats such as EPUB may contain useful embedded title, author, publisher, and identifier data. Other formats may contain incomplete or inaccurate metadata. Re-adding a file can recover what is embedded, but the individual metadata.opf backup is generally a better source for calibre-specific catalog information.
9.4 Why does metadata.db keep becoming locked or damaged?
Common causes include opening one library from multiple computers, running multiple calibre processes, storing the active library on a network share, cloud-sync conflicts, abrupt power loss, failing storage, security software interference, and insufficient permissions. Repeated damage means you should address the storage or access pattern rather than repeatedly rebuilding the database.
9.5 Will reinstalling calibre restore metadata.db?
No. A normal reinstall replaces application files, not the database inside your personal library folder. Test a copied library on local storage and use Restore database before considering a reinstall.
9.6 What is the best backup after recovery?
Back up the entire library folder while calibre is closed, including metadata.db, every author and title folder, OPF files, covers, and all book formats. Keep at least one versioned or offline copy so that accidental deletion or synchronization errors do not immediately affect every backup.
Once the recovered library displays the expected catalog, opens representative books, passes a reasonable library check, and has a verified backup, stop changing settings. Further experimentation can introduce new discrepancies after the original problem has already been solved.