How to Repair a Broken or Corrupted EPUB File
EPUB files can become unreadable after a bad download, failed conversion, or accidental edit. Here's how to diagnose what's wrong and fix most common EPUB errors.
Symptoms of a Broken EPUB
- EPUB reader shows "Cannot open file" or "Invalid format" error
- Book opens but shows blank pages or missing text
- Images are missing or show broken image icons
- Table of contents is empty or navigation doesn't work
- EPUBCheck reports errors
- File won't upload to KDP, Apple Books, or Kobo
Step 1: Run EPUBCheck to Identify the Problem
Before attempting repairs, diagnose the specific errors:
java -jar epubcheck.jar book.epub
Read the error output carefully. EPUBCheck identifies exactly which files have problems and what type of error. Common categories:
- OPF errors — problems in the package file (metadata, manifest, spine)
- RSC errors — missing or misreferenced files
- NAV errors — table of contents issues
- HTM errors — invalid HTML in chapter files
Step 2: Open the EPUB as a ZIP
EPUB files are ZIP archives. Rename the file from .epub to .zip and extract it to inspect the internals:
# On macOS/Linux
cp book.epub book.zip
unzip book.zip -d book-extracted/
# On Windows
Rename-Item book.epub book.zip
Expand-Archive book.zip -DestinationPath book-extracted
The extracted folder contains: META-INF/container.xml, an OPF file (usually in OEBPS/ or content.opf), HTML chapter files, CSS, and images.
Fix 1: Missing or Mislinked Files (RSC-007)
The most common EPUB error: a file referenced in the OPF manifest doesn't exist (wrong filename, case mismatch, or file was deleted).
- Open the OPF file in a text editor. Find the
<manifest>section. - Check each
<item href="...">— the path must exactly match the actual filename (case-sensitive on Linux/macOS). - Add any missing files back to the EPUB folder, or remove the manifest entry if the file is truly absent.
- Repack: zip the folder back into an EPUB (the mimetype file must be first and uncompressed).
# Repack EPUB correctly (mimetype must be first, stored uncompressed)
cd book-extracted/
zip -X ../book-fixed.epub mimetype
zip -rg ../book-fixed.epub META-INF OEBPS
Fix 2: Missing or Empty TOC (NAV-003)
If the EPUB has no nav.xhtml or the NAV document is empty:
- Open Sigil or Calibre's Edit Book.
- Go to Tools → Table of Contents → Generate Table of Contents.
- This creates or rebuilds the NAV document from heading tags in the chapter files.
- Save the EPUB.
Fix 3: Malformed OPF (Missing Required Metadata)
KDP and EPUBCheck require these fields in the OPF <metadata>:
<dc:title>Book Title</dc:title>
<dc:language>en</dc:language>
<dc:identifier id="uid">urn:uuid:your-uuid-here</dc:identifier>
Open the OPF file, add any missing elements, and save. Use Calibre's metadata editor (select book → E) as a GUI alternative.
Fix 4: Corrupted ZIP Structure
If the EPUB can't be opened as a ZIP (completely corrupted), try:
# Test ZIP integrity
unzip -t book.epub
# Attempt ZIP repair
zip -F book.epub --out book-repaired.epub
If the ZIP is damaged beyond repair, check if you have a backup or re-download the file from the original source.
Fix 5: Use Calibre to Reconvert
For EPUBs that won't open in readers but can still be parsed, Calibre's reconvert pipeline often repairs structural problems automatically:
- Add the broken EPUB to Calibre.
- Right-click → Convert books → Convert individually.
- Set input AND output format to EPUB.
- Click OK. Calibre parses and re-exports the EPUB, fixing many structural errors.
Online EPUB Repair Tools
- epub-fixer.com — upload an EPUB, get a repaired version. Works for common OPF and manifest errors.
- Sigil — opens many broken EPUBs that readers reject, and lets you fix issues manually.
Converting a PDF to a clean EPUB from scratch? toolkit.bot generates EPUBCheck-valid output.
Convert PDF to EPUB →