Skip to content
EPUBCheck · Package and ZIP container

EPUBCheck PKG-005: extra field on mimetype

Updated:

EPUBCheck PKG-005 is an error message: “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.” The mimetype entry in the ZIP carries an extra field, which the EPUB container rules forbid for that one file. Reading apps identify an EPUB by finding the mimetype text at a fixed position near the start of the file, and an extra field moves it.

The official message

The mimetype file has an extra field of length %1$s. The use of the extra field feature of the ZIP format is not permitted for the mimetype file.

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

  • ZIP tools that add extended timestamps or file attributes to every entry by default, as many desktop compressors do.
  • Re-zipping the book folder with the operating system's built-in compress command.

How to fix it

  1. Do not edit the archive in place: rebuild it from the book folder.
  2. Zip the mimetype file without extra attributes. With Info-ZIP the -X option leaves them out: 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 to confirm the message is gone.

When it's not this

If mimetype is missing or not first, that is PKG-006; if its text is wrong, PKG-007.

Terms used here

Other PKG messages

  • PKG-004 Corrupted EPUB ZIP header.
  • PKG-006 Mimetype file entry is missing or is not the first file in the archive.
  • PKG-003 Unable to read EPUB file header. This is likely a corrupted EPUB file.
  • PKG-007 The content of the mimetype file must be the string "application/epub+zip"…
  • PKG-008 Unable to read file "…".
  • PKG-001 Validating the EPUB against version … but detected version ….

Sources

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

FAQ

What does EPUBCheck PKG-005 mean?

EPUBCheck PKG-005 is an error message: “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.” The mimetype entry in the ZIP carries an extra field, which the EPUB container rules forbid for that one file. Reading apps identify an EPUB by finding the mimetype text at a fixed position near the start of the file, and an extra field moves it.

Is PKG-005 an error?

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