Skip to content
EPUBCheck · Package and ZIP container

EPUBCheck PKG-006: mimetype missing or not first

Updated:

EPUBCheck PKG-006 is an error message: “Mimetype file entry is missing or is not the first file in the archive.” The mimetype file is missing or is not the first entry of the ZIP archive. Reading apps identify the file as an EPUB from its first bytes, so EPUB requires mimetype to be the first file, stored uncompressed.

The official message

Mimetype file entry is missing or is not the first file in the archive.

Default severity
Error. The EPUB breaks a rule of the specification and is invalid. Stores and Send to Kindle may reject it, and EPUBCheck exits with status 1.
EPUBCheck version
5.4.0

Typical causes

  • The book folder was compressed with a generic tool that adds files in alphabetical or arbitrary order.
  • The mimetype file was deleted while editing the EPUB.
  • The mimetype file was compressed along with the rest of the files.

How to fix it

  1. Make sure a file named mimetype containing exactly application/epub+zip sits at the root of the book.
  2. Rebuild the archive with the mimetype file first and stored uncompressed, for example from the folder that contains the book: zip -X0 book.epub mimetype and then zip -rX9 book.epub META-INF OEBPS (use your own folder names).
  3. Validate again: if PKG-007 appears next, the content of mimetype is wrong too.

When it's not this

If mimetype is first but has an extra ZIP field, that is PKG-005; if its content is wrong, PKG-007.

Terms used here

Other PKG messages

  • PKG-005 The mimetype file has an extra field of length …. The use of the extra field feature of the ZIP format is not permitted for the mimetype file.
  • PKG-007 The content of the mimetype file must be the string "application/epub+zip"…
  • PKG-004 Corrupted EPUB ZIP header.
  • PKG-008 Unable to read file "…".
  • PKG-003 Unable to read EPUB file header. This is likely a corrupted EPUB file.
  • PKG-009 The file name "…" contains characters that are not allowed in OCF file names: ….

Sources

Message text and severity from EPUBCheck 5.4.0 (W3C, BSD-3-Clause). Explanation by EpubCC.

FAQ

What does EPUBCheck PKG-006 mean?

EPUBCheck PKG-006 is an error message: “Mimetype file entry is missing or is not the first file in the archive.” The mimetype file is missing or is not the first entry of the ZIP archive. Reading apps identify the file as an EPUB from its first bytes, so EPUB requires mimetype to be the first file, stored uncompressed.

Is PKG-006 an error?

PKG-006 is reported as error by default. The EPUB breaks a rule of the specification and is invalid. Stores and Send to Kindle may reject it, and EPUBCheck exits with status 1.