EPUB Error: Missing or Invalid container.xml

PKG-006: Required META-INF/container.xml resource is missing. Or: XML parse error in META-INF/container.xml — element not terminated correctly

What causes this error?

Every EPUB file is a ZIP archive with a mandatory folder structure. The most critical component is META-INF/container.xml — a small XML file that tells reading systems and validators where to find the OPF package document that defines the rest of the book. Without it, there is no valid entry point: no reader, validator, or distribution platform can determine how to open the EPUB. This error fires when container.xml is absent from the archive entirely, placed in the wrong folder (outside META-INF/), or contains malformed XML that prevents parsing. Common causes are manual ZIP creation without preserving the required folder structure, extraction and re-archiving with a general-purpose ZIP tool that drops the META-INF directory, and corrupted exports from older conversion software.

How to fix it

  1. Unzip your EPUB and confirm META-INF/container.xml exists at the root of the archive — the META-INF folder must sit at the same level as OEBPS or OPS, not inside them.
  2. If container.xml is missing, create it as a plain XML file inside a new META-INF/ folder. It must contain a <container> element with a <rootfile> child declaring the full path to your OPF file (e.g., full-path="OEBPS/content.opf") and media-type="application/oebps-package+xml".
  3. If the file exists but EPUBCheck reports an XML parse error, open it in a text editor and fix the syntax — check for missing closing tags, unquoted attribute values, or an incorrect XML declaration at the top of the file.
  4. When re-packing the EPUB into a ZIP, use an EPUB-aware tool such as Sigil or Calibre's Export function rather than a generic ZIP utility — most ZIP tools do not preserve the required file order or folder structure.
  5. Re-validate with EPUBCheck to confirm container.xml is recognized and that the OPF rootfile path it declares resolves to an actual file in the package.

Common questions

Why is container.xml the most important file in an EPUB?

It's the entry point for the entire format. Reading systems open the EPUB ZIP, locate META-INF/container.xml first, and read it to find the OPF package document path. Every other file in the EPUB is discovered from the OPF — without container.xml there is no valid starting point and the file cannot be opened or validated at all.

My EPUB opens in Calibre but EPUBCheck still reports a missing container.xml. Why?

Calibre's viewer is permissive — it scans the ZIP archive directly for likely OPF files when container.xml is missing or malformed. EPUBCheck and distribution platforms (KDP, Apple Books) follow the EPUB specification strictly: container.xml must exist, be in the correct location, and be valid XML before any other file is examined.

Check your EPUB before uploading

The free EPUB Validator catches structure, metadata, and navigation errors — no signup, no Java, runs in the browser.

Validate Your EPUB Free →

Building your EPUB correctly from the start prevents most of these errors before they happen. See the EPUB formatting guide for the full workflow: manuscript cleanup, TOC, front matter, EPUB 3.0 generation, and validation.

Common EPUB errors: Invalid or missing EPUB mimetype file, Invalid OPF structure errors

Platform rejection guides: Why Amazon KDP rejects ebooks, Why Apple Books rejects ebooks