Skip to content
EPUBCheck · Package document (OPF)

EPUBCheck OPF-006: invalid URI for a prefix

Updated:

EPUBCheck OPF-006 is an error message: “Invalid prefix declaration: URI "…" is not a valid URI.” The URI given for a prefix in the prefix attribute is not a valid URI. Properties that use the prefix expand to that URI, so an invalid value makes them meaningless to reading apps and validators.

The official message

Invalid prefix declaration: URI "%1$s" is not a valid URI.

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 typo in the URI, such as a missing colon after http or a space inside the address.
  • Text that is not a URI, such as a vocabulary name, written where the URI should be.
  • Two mappings run together so that the next prefix is read as part of the previous URI.

How to fix it

  1. Find the mapping EPUBCheck names in the prefix attribute of the package element.
  2. Replace the value with the vocabulary's published address, copied exactly from its documentation.
  3. 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/".

When it's not this

If the prefix has no URI at all, that is OPF-005, not OPF-006.

Terms used here

Other OPF messages

  • OPF-005 Invalid prefix declaration: URI for prefix "…" doesn’t exist.
  • OPF-007 Re-declaration of reserved prefix "…".
  • OPF-004 Invalid prefix declaration: leading or trailing whitespace is not allowed.

Sources

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

FAQ

What does EPUBCheck OPF-006 mean?

EPUBCheck OPF-006 is an error message: “Invalid prefix declaration: URI "…" is not a valid URI.” The URI given for a prefix in the prefix attribute is not a valid URI. Properties that use the prefix expand to that URI, so an invalid value makes them meaningless to reading apps and validators.

Is OPF-006 an error?

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