Skip to content
EPUBCheck · Package document (OPF)

EPUBCheck OPF-005: prefix without a URI

Updated:

EPUBCheck OPF-005 is an error message: “Invalid prefix declaration: URI for prefix "…" doesn’t exist.” A prefix in the prefix attribute has no URI after it. Each prefix exists only to stand for a vocabulary URI, so a mapping without one cannot be used by any property in the package document.

The official message

Invalid prefix declaration: URI for prefix "%1$s" doesn’t exist.

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 mapping cut short, such as "ibooks:" at the end of the attribute.
  • A URI deleted while editing, leaving only the prefix and its colon.
  • A line break or quote in the wrong place that splits the URI away from its prefix.

How to fix it

  1. Find the prefix EPUBCheck names in the prefix attribute of the package element.
  2. Write each mapping as the prefix name, a colon, one space and the vocabulary URI, and separate mappings with whitespace, for example prefix="ibooks: http://vocabulary.itunes.apple.com/rdf/ibooks/vocabulary-extensions-1.0/ foaf: http://xmlns.com/foaf/spec/".
  3. If the prefix is not used by any property in the package document, delete the whole mapping instead.

When it's not this

If a URI is there but malformed, EPUBCheck reports OPF-006; if the layout of spaces and colons is the problem, it reports a variant of OPF-004.

Terms used here

Other OPF messages

  • OPF-004 Invalid prefix declaration: leading or trailing whitespace is not allowed.
  • OPF-006 Invalid prefix declaration: URI "…" is not a valid URI.
  • OPF-003 Item "…" exists in the EPUB, but is not declared in the OPF manifest.
  • OPF-007 Re-declaration of reserved prefix "…".

Sources

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

FAQ

What does EPUBCheck OPF-005 mean?

EPUBCheck OPF-005 is an error message: “Invalid prefix declaration: URI for prefix "…" doesn’t exist.” A prefix in the prefix attribute has no URI after it. Each prefix exists only to stand for a vocabulary URI, so a mapping without one cannot be used by any property in the package document.

Is OPF-005 an error?

OPF-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.

PDF to EPUB tools

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