Skip to content
EPUBCheck · Package and ZIP container

EPUBCheck PKG-007: wrong mimetype file content

Updated:

EPUBCheck PKG-007 is an error message: “The content of the mimetype file must be the string "application/epub+zip"….” The mimetype file must contain exactly the text application/epub+zip, with nothing before or after it. EPUB 3.3 forbids leading or trailing whitespace and a byte order mark in that file.

The official message

The content of the mimetype file must be the string "application/epub+zip"%1$s

Variants

  • whitespace: with no whitespace or newline.
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

%1$s, %2$s… are filled in with the file, value or element EPUBCheck found.

Typical causes

  • A trailing newline or space added by a text editor.
  • A different value, such as a typo or another media type.
  • A byte order mark (BOM) added by an editor that saves UTF-8 with BOM.

How to fix it

  1. Recreate the file without a newline, for example with printf 'application/epub+zip' > mimetype.
  2. Rebuild the archive with mimetype first: 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.

When it's not this

If the file is missing or not first in the archive, that is PKG-006.

Terms used here

Other PKG messages

  • PKG-006 Mimetype file entry is missing or is not the first file in the archive.
  • PKG-008 Unable to read file "…".
  • 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-009 The file name "…" contains characters that are not allowed in OCF file names: ….
  • PKG-004 Corrupted EPUB ZIP header.
  • PKG-010 The file name "…" contains spaces, which may create interoperability issues with older reading systems.

Sources

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

FAQ

What does EPUBCheck PKG-007 mean?

EPUBCheck PKG-007 is an error message: “The content of the mimetype file must be the string "application/epub+zip"….” The mimetype file must contain exactly the text application/epub+zip, with nothing before or after it. EPUB 3.3 forbids leading or trailing whitespace and a byte order mark in that file.

Is PKG-007 an error?

PKG-007 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.

PDF to EPUB tools

Every tool uses the same engine and starts with a free 5-page sample.