EPUBCheck PKG-004: corrupted ZIP header
Updated:
EPUBCheck PKG-004 is a fatal error message: “Corrupted EPUB ZIP header.” The ZIP structure of the EPUB is damaged, so EPUBCheck cannot list or read its files. It is a fatal error: nothing inside the book can be checked until the archive is rebuilt, and reading apps usually refuse to open it.
The official message
Corrupted EPUB ZIP header.
- Default severity
- Fatal error. EPUBCheck could not continue checking this part of the EPUB. The file is invalid.
- EPUBCheck version
- 5.4.0
Typical causes
- A truncated download or transfer.
- A tool that wrote the ZIP incorrectly or was interrupted while writing it.
- A file edited in place by a program that does not understand ZIP archives.
How to fix it
- Get a fresh copy of the EPUB or export it again from its source.
- Rebuild the archive with the mimetype file first and stored uncompressed, for example from the folder that contains the book:
zip -X0 book.epub mimetypeand thenzip -rX9 book.epub META-INF OEBPS(use your own folder names). - Run EPUBCheck again on the rebuilt file and fix any message that appears next: a damaged archive can hide other problems until it can be read.
When it's not this
If the first bytes are not a ZIP at all (a renamed file), EPUBCheck reports PKG-003 instead.
Terms used here
Other PKG messages
PKG-003Unable to read EPUB file header. This is likely a corrupted EPUB file.PKG-005The 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-006Mimetype file entry is missing or is not the first file in the archive.PKG-001Validating the EPUB against version … but detected version ….PKG-007The content of the mimetype file must be the string "application/epub+zip"…PKG-008Unable to read file "…".
Sources
Message text and severity from EPUBCheck 5.4.0 (W3C, BSD-3-Clause). Explanation by EpubCC.