EPUBCheck OPF-002: package document not found
Updated:
EPUBCheck OPF-002 is a fatal error message: “The OPF file "…" was not found in the EPUB.” The package document named in META-INF/container.xml is not in the archive. EPUBCheck stops there, because the package document lists every other file, so nothing else in the book can be checked until it is found.
The official message
The OPF file "%1$s" was not found in the EPUB.
- Default severity
- Fatal error. EPUBCheck could not continue checking this part of the EPUB. The file is invalid.
- EPUBCheck version
- 5.4.0
%1$s, %2$s… are filled in with the file, value or element EPUBCheck found.
Typical causes
- A full-path in container.xml that does not match the real path of the .opf file, often a difference in upper or lower case.
- The .opf file was renamed or moved to another folder after container.xml was written.
- The .opf file was left out when the folder was zipped.
How to fix it
- Open META-INF/container.xml and read the full-path attribute of the rootfile element.
- Compare it with the real location of the .opf file inside the archive, letter by letter: paths in an EPUB are case-sensitive.
- Correct full-path (or move the file) so they match, then rebuild the EPUB.
When it's not this
If container.xml itself is missing, EPUBCheck reports RSC-002 instead.
Terms used here
Other OPF messages
OPF-001There was an error when parsing the EPUB version: ….OPF-003Item "…" exists in the EPUB, but is not declared in the OPF manifest.OPF-004Invalid prefix declaration: leading or trailing whitespace is not allowed.OPF-005Invalid prefix declaration: URI for prefix "…" doesn’t exist.OPF-006Invalid prefix declaration: URI "…" is not a valid URI.OPF-007Re-declaration of reserved prefix "…".
Sources
Message text and severity from EPUBCheck 5.4.0 (W3C, BSD-3-Clause). Explanation by EpubCC.