MarginaGet Margina
Articles

Publié

An EPUB that won't open isn't mysterious — it's a ZIP missing one of three required parts. Here's what those parts are and how to spot which one failed.

What an EPUB Really Is

An EPUB isn't really one file. It's a ZIP archive wearing a different extension, and inside it sit exactly three pieces a reading app needs to open the book at all: a small file called mimetype, a container.xml file inside a folder named META-INF, and a package document — usually called an OPF file — that lists every chapter, image, and stylesheet the book contains. Each one does a single, specific job. The mimetype file identifies the archive as an EPUB before anything else gets unpacked. Container.xml tells the reading app where to find the package document. And the package document handles everything else — title, reading order, the exact files that belong to the book.

That's the whole architecture. For the fuller picture of what a well-formed EPUB looks like inside, we've written about EPUB 3's anatomy elsewhere. What matters here is narrower: when one of those three pieces goes missing, gets moved, or turns malformed, the file doesn't degrade gracefully. It just doesn't open.

The Four Ways an EPUB Actually Breaks

Almost every "this EPUB won't open" problem traces back to one of four specific failures.

A corrupted ZIP header

Cut off mid-download, interrupted mid-transfer, copied from a source that stopped partway — if the archive itself is damaged, the reading app can't even get past opening the ZIP. This is the bluntest failure: the file isn't malformed so much as incomplete, and there's usually nothing inside it worth recovering. You need the file again, from wherever it came from.

A mimetype file that's compressed or out of place

This is the most common way a perfectly good EPUB gets broken by accident. The mimetype file has two strict requirements: it must be the very first file in the archive, and it must be stored uncompressed. Ordinary zip tools don't respect either rule by default — Finder's "Compress," 7-Zip, a plain zip -r command all compress everything and add files in whatever order the filesystem hands them over. Open an EPUB, make a small edit, re-zip it with a general-purpose tool, and you can silently turn a working file into one some reading apps reject outright.

A container.xml pointing to the wrong place

Container.xml holds a single reference — a file path — to where the package document lives. If that path is even slightly wrong, because a folder got renamed, flattened, or moved during an edit, the reading app goes looking for the book's manifest somewhere that no longer has it. The package document might still be sitting right there in the archive; the app just can't find the line of text that says where.

A manifest that doesn't match the archive

The package document lists every file the book uses, and only the files it uses. When that list drifts out of sync with what's actually inside the archive — a chapter file that exists but was never added, an entry pointing to a file that's since been deleted — the result is a book that opens but breaks partway through, or fails validation outright. That's a different problem than garbled or mismatched characters in the text itself, which usually comes down to an encoding issue rather than a structural one.

What Epubcheck Is Actually Telling You

Want to know exactly which of those four things happened? Reach for epubcheck — the open-source validator maintained for the W3C that publishers, retailers, and reading apps all run against a file before accepting it. It doesn't just say "broken." It returns a specific code: a mimetype-sequencing error reads differently from a missing container.xml, which reads differently from a manifest reference pointing at a file that isn't there. The full list of what each code means is public, and once you know which class of error you're looking at, the fix is usually obvious — rebuild the archive, fix the path, or reconcile the manifest with what's actually inside.

What This Isn't

Two problems get confused here, and they're not the same. A structurally broken EPUB fails to open for everyone, on every app, because something it needs is missing or malformed. A DRM-protected file is different — it opens exactly as designed, but only inside the specific store or account it's licensed to. One is corruption. The other is a locked door with a key that isn't yours. They look similar from the outside — "the book won't open" — but the cause, and the fix, have nothing in common.

Frequently Asked Questions

Can I fix a corrupted EPUB myself?

Sometimes. If it's a mimetype ordering or compression issue, rebuilding the archive with the mimetype stored first, uncompressed, often resolves it. If the ZIP header itself is damaged from an interrupted transfer, there's usually nothing to recover — you need the file again from its source.

Why did my EPUB break after I edited it?

Most editing tools re-save the whole archive, and general-purpose zip utilities compress every entry and reorder files by default. That silently breaks the mimetype file's two hard requirements — stored uncompressed, first in the archive — even though the ZIP still opens fine in a file browser.

Is a "won't open" EPUB the same as a DRM-protected one?

No. A structurally broken EPUB fails for every reader everywhere, because a required piece — the mimetype, container.xml, or OPF — is missing or malformed. A DRM-protected file opens fine structurally but is locked to a specific account or app, which is a licensing restriction, not corruption.

What does "OPF file not found" actually mean?

The file that points to your book's content — the package document — either isn't where container.xml says it is, or isn't in the archive at all. This usually happens when a folder got renamed or flattened during editing, breaking the exact path reference the reading system depends on.

How can I tell what's actually wrong with a file?

Run it through epubcheck, the open-source validator publishers and retailers use. It returns a specific code — a missing mimetype, a bad container path, a manifest mismatch — telling you exactly which required part failed, rather than just saying the file is broken.

Conclusion

An EPUB that won't open feels like a mystery until you know what's actually inside one. It isn't the book that's broken — it's one of three small, specific pieces the archive depends on: the mimetype file, container.xml, or the package document. Once you know which one, the fix is usually mechanical, not magical. Margina reads whatever format arrives without asking you to fix it first, but for a file that's genuinely missing one of these pieces, knowing the cause turns a dead end into a two-minute repair.