If a store refused your EPUB with a code like PKG-006 or RSC-007, it ran EPUBCheck on it: the checker ebook stores build their upload checks on. Its messages are accurate but hard to read. Each is a code, a file, a line and column, and a sentence written for someone who already knows the standard. This page explains them.
We broke a valid EPUB one fault at a time and recorded what EPUBCheck said, so the messages below are the ones you'll see. Passing doesn't guarantee that a store will accept the book, since it can be refused for things a checker never looks at. Failing, though, can get a file refused before anyone has looked at it.
The short answer
Find your code below. PKG codes are about how the file was zipped. The reference codes, RSC and OPF, are about something that points at a file or an anchor that isn't there. The document codes, such as RSC-016 and RSC-005, mean a chapter or the package file isn't written the way the standard requires. Fix every FATAL message first, fix causes rather than working down the list, and run the check again.
The packaging errors
An EPUB is a ZIP file with rules about how the ZIP itself is built. EPUBCheck checks them first, and zipping a folder in Finder or Explorer breaks them.
PKG-007 The mimetype file holds more than that one line
The first file must be called mimetype and contain only that
string, with no newline at the end. A text editor that adds a newline when
it saves the file causes this.
The EPUB standard also forbids compressing the file. In this test, EPUBCheck 5.3.0 did not report a compressed mimetype file, so do not count on it to catch one.
PKG-006 The mimetype file is not first
Order inside a ZIP is not alphabetical, and file managers do not let you set it. The mimetype entry must come first, so a reading device can identify the format from the opening bytes.
PKG-007 is about what the file holds, PKG-006 about where it is. Read the message, not the number.
PKG-005 The mimetype entry has an extra field
An unpacked EPUB zipped again with the zip command on a Mac
kept the mimetype file first and uncompressed, but its entry carried an
extra field, which the standard forbids. The same folder zipped with
zip -X, which leaves extra fields out, passed.
The reference errors
All the same idea: something points at something that isn't there, such as a file that was renamed, moved or never included.
RSC-001 A file named in the manifest does not exist
The package promises a file the archive does not have, for example an image placed in the manuscript from your disk and never copied into the ebook.
RSC-007 A link or stylesheet points at a missing file
The same failure from the other end: a chapter links to a page that is not
there. It also catches a @font-face rule whose font file was
left behind, which can happen when a theme is copied between projects.
RSC-012 A link points at an anchor that does not exist
The file is right and the #anchor after it is wrong. Often this is a footnote or endnote whose reference survived
an edit when the note did not.
RSC-011 The contents list points at something outside the reading order
The contents list links to a chapter that exists but is not in the sequence a reader moves through. Take this one seriously; see the last section of this page.
OPF-049 The reading order names a manifest entry that isn't there
This arrives with an RSC-005 saying the same thing in specification language: one problem, two messages. EPUBCheck's error count is not a count of problems.
RSC-006 and OPF-014 An image is loaded from the internet
The property "remote-resources" should be declared in the OPF file.
An ebook must contain everything it shows. An <img> with an
https:// source vanishes when the reader is offline, so it is
refused.
The document errors
RSC-016 — fatal — The XHTML is not well formed
XHTML is XML, and XML tolerates no mistakes: one unclosed tag stops the parse. It is reported twice, as FATAL RSC-016 and ERROR RSC-005, and nothing after the broken tag is checked. Fix it and run again before reading the rest.
Browsers repair broken HTML silently, which is why a file can look perfect in a browser and be fatally invalid here.
RSC-005 Something required is missing or in the wrong place
Error while parsing file: Exactly one "toc" nav element must be present
RSC-005 is the general “this does not match the schema” message, and the useful part is the sentence after the colon. The two above are a package with no title, and a navigation document whose contents list isn't marked as the contents list.
HTM-004 An old DOCTYPE
A chapter of an EPUB 3 takes <!DOCTYPE html>, or no
doctype at all. The old XHTML 1.1 doctype is an error. EPUBCheck 4.2.6 let
it pass, so advice that calls it harmless is out of date.
OPF-003 — usage — A file is in the archive but not declared
EPUBCheck 5.3.0 reports this only when it is run with -u,
which adds usage messages. A normal run says nothing.
Usually harmless: a leftover file, a .DS_Store, an editor's
backup. Clear it anyway, because readers have to download that dead weight.
A file that passes but should not reassure you
A language tag that is not a language tag.
english instead of en produced
0 errors. Reading devices use that field
for hyphenation and text-to-speech, so a wrong value quietly degrades the
book.
The failure EPUBCheck cannot catch
A whole chapter was removed from the reading order and from the contents list, with its file left in the archive. The result:
Messages: 0 fatals / 0 errors / 0 warnings / 0 infos
A valid ebook, missing a chapter. The standard only requires the parts an EPUB declares to agree with each other, and they did. Remove the chapter from one of the two places and you get RSC-011; remove it from both and it is a shorter book.
A clean EPUBCheck report means the file is well formed, not that it is your book. Only opening the book and counting the chapters catches a missing one.
Reading a report
- Fix every FATAL first. Parsing stopped there, so the rest of the report was written from an incomplete picture.
- One problem can produce several messages. Fix causes and run again, rather than working down the list.
- For RSC-005, read the sentence, not the code.
- Warnings are optional and cheap to fix. Clear them, so the next new one stands out.
We check every EPUB we make with EPUBCheck itself. This page quotes the messages word for word, because paraphrasing them loses the part that tells you what to do.