Errors
Format error codes and how to fix them.
Every error Format raises while building your document carries a code. The code is stable across versions; the message is the human-readable explanation. Read the code to recognize the failure mode, and read the message to find the offending element.
This page lists every code, what triggers it, and how to fix it.
Where errors surface
Most errors fire while Format reads the model from your HTML. The document tree is malformed, so the read stops before any page is laid out. A few fire later, during pagination, when the tree parsed cleanly but produced nothing to render. Studio (in your browser) and the API (in production) raise the same codes.
| Surface | What you see |
|---|---|
| Studio | The diagnostics panel outlines the offending element in red. The code and message appear inline. The preview shows the document up to the error, and broken parts do not render. |
| API | The render request fails with an HTTP error response. The body is JSON, with the code and message nested under an error object: { "error": { "code": "INVALID_LAYOUT", "message": "..." } }. No PDF is produced. |
The API masks any internal failure to a single code. A code whose HTTP status is in the 5xx range never reaches the client by its own name; the response carries INTERNAL_SERVER_ERROR and a support reference instead. The 4xx codes below, which describe a fault in the document you sent, pass through unchanged, so you can act on them directly.
If you author and preview in Studio, you catch every parse-time error before it reaches the API.
Document model errors
These fire while Format parses the model from authored HTML. They mean the document tree itself is malformed, not that anything went wrong at render time. Each is a 4xx, so the API returns the code as-is.
NO_DOCUMENT_FOUND
No root <template data-type="document"> exists in the rendered output, so Format found nothing to parse.
| Trigger | Fix |
|---|---|
| No Document template in the rendered output | Wrap your content in a Document. With the SDK, render a <Document>; in raw HTML, the root must be <template data-type="document">. |
This code carries a 5xx status, so the API reports it as INTERNAL_SERVER_ERROR. In normal use the SDK and Studio always emit the Document wrapper, so reaching it means the rendered HTML arrived without a Document root.
INVALID_DOCUMENT
The root <template data-type="document"> is missing a required attribute.
| Trigger | Fix |
|---|---|
data-title missing | Add data-title="..." to the Document. The title is required and is written to the rendered PDF's metadata. |
INVALID_LAYOUT
A Layout is missing a required page dimension, or a table of contents sits in the Layout scaffolding instead of inside a Flow.
| Trigger | Fix |
|---|---|
data-width or data-height missing | Add both to the Layout, each a CSS px length, e.g. data-width="793.71px". They set the page size for every page this Layout produces. |
| A table of contents in the scaffolding | Move it inside a Flow. A table of contents paginates, so it belongs in the region that flows, not in the markup that reprints on every page. |
A Layout id is optional, and Format generates one when you omit it. The id is a non-unique CSS label, so several Layouts may share an id to reuse a design. Sharing an id is no longer an error.
INVALID_FRAME
A Frame is missing its id, or two Frames in the same Layout share an id.
| Trigger | Fix |
|---|---|
data-id missing | Add data-id="..." to the Frame. Frame ids must be unique within the owning Layout. |
| Duplicate Frame id in same Layout | Rename one of the Frames. A Flow finds its overflow boundary by the closest ancestor Frame's id, so ids must be distinct. |
INVALID_VALUE
A page dimension that takes a CSS px length could not be parsed.
| Trigger | Fix |
|---|---|
Value doesn't end in px | Use a CSS px length, e.g. "793.71px". Other units are not accepted. |
| Value isn't a valid number | Check for typos. The leading numeric portion must parse as a float. |
Resource errors
These fire while Format inlines stylesheets before rendering. Each is a 4xx, so the API returns the code as-is.
INVALID_HTML_LINK_ELEMENT
A <link> element uses a rel other than stylesheet, whether it sits inside a Layout or directly under the Document.
| Trigger | Fix |
|---|---|
<link rel="..."> is anything other than stylesheet | Format inlines stylesheets only. Remove the link, or change rel to stylesheet. |
ASSET_ERROR
A stylesheet Format tried to inline could not be fetched or read. The <link rel="stylesheet"> href, or a CSS @import inside it, pointed at something that failed to load.
| Trigger | Fix |
|---|---|
A <link> stylesheet failed to fetch | Confirm the stylesheet is in your assets bundle and the href matches its path. See Assets. |
An @import inside a stylesheet failed to resolve | Bundle the imported file and check the import path. |
INVALID_ASSET_REFERENCE
An asset the document references (an image, font, or stylesheet) failed to load during the render. This is raised by the render pipeline rather than during parsing, so you see it from the API rather than in Studio.
| Trigger | Fix |
|---|---|
| The path doesn't match a file in the bundle | Check the path and confirm the file ships in the bundle. See Assets. |
| A remote URL that wasn't bundled | A remote reference resolves only when you bundle it through remote assets ahead of the render; otherwise it fails to load. Ship the file in the bundle, or see Remote assets. |
Numbering errors
These fire while Format parses a numbering directive that is missing a required attribute. Each is a 4xx, so the API returns the code as-is. A directive that names a target it cannot resolve does not error; Format reports it instead in the document summary diagnostics, where Studio surfaces it.
| Code | Trigger | Fix |
|---|---|---|
INVALID_COUNTER | A <Counter> is missing data-name | Add data-name="..." naming the counter to act on. |
INVALID_COUNTER_DEF | A <CounterDef> is missing data-name | Add data-name="..." naming the counter you are defining. |
INVALID_REF | A <Ref> is missing data-to | Add data-to="..." with the id of the element you reference. |
INVALID_NUMBERING_RULE | A <NumberingRule> is missing data-match | Add data-match="..." with the selector the rule numbers. |
Pagination errors
These fire after parsing, while Format lays out pages. They mean the document parsed cleanly but produced nothing to render.
NO_LAYOUT_PROVIDED
The Document parsed, but it holds no Layout. A Document needs at least one Layout to render any pages. This code is a 4xx, so the API returns it as-is.
| Trigger | Fix |
|---|---|
| Document has no Layout | Add a Layout. It sets the page dimensions and holds the Flows that paginate. |
NO_PAGES_RENDERED
A Layout ran but produced zero pages, because its Flows held no content to lay out. This code is a 4xx, so the API returns it as-is.
| Trigger | Fix |
|---|---|
| A Flow has no content | Give the Flow content to paginate. A Flow with an empty Stream and no children renders nothing. |
PAGE_PROGRESS_STALLED
Pagination produced three empty pages in a row, which means content still queued can never be placed. An empty page always accepts its first item, so a run of empty pages points at content that paints nothing, never a Flow that simply ran long.
| Trigger | Fix |
|---|---|
| Queued content that can never place | Check the run near the reported page for items that render nothing, for example a long stretch of whitespace-only nodes. |
This code carries a 5xx status, so the API reports it as INTERNAL_SERVER_ERROR. Format fails loudly here rather than quietly dropping the content it cannot place.
Engine configuration errors
These come from the options passed alongside the document, not from the document itself. In normal use the SDK and Studio set them for you, and both carry a 5xx status, so the API reports them as INTERNAL_SERVER_ERROR.
INVALID_ENGINE_OPTIONS
An engine option is malformed, or a root scope selector matched no element.
| Trigger | Fix |
|---|---|
| An option value is invalid | This is set by the host, not your document. If you do not set engine options directly, file a bug. |
INVALID_AUTORUN_OPTIONS
The autorun options that drive Format on the page are malformed.
| Trigger | Fix |
|---|---|
| An autorun option value is invalid | This is set by the host bootstrap, not your document. If you do not set autorun options directly, file a bug. |
INTERNAL_ERROR
An internal invariant failed, for example a paginated page missing the key Format wrote to it.
| Trigger | Fix |
|---|---|
| An engine invariant broke | This signals a bug rather than a fault in your document. File a bug with a reproduction. |
Quick lookup table
A summary of every code, where it comes from, and how the API reports it:
| Code | Source | API status | Most common cause |
|---|---|---|---|
NO_DOCUMENT_FOUND | Document | INTERNAL_SERVER_ERROR | No data-type="document" root in the rendered output |
INVALID_DOCUMENT | Document | passes through | data-title missing |
INVALID_LAYOUT | Layout | passes through | Missing data-width / data-height, or a table of contents in the scaffolding |
INVALID_FRAME | Frame | passes through | Missing or duplicate data-id |
INVALID_VALUE | Width / height | passes through | Value isn't a CSS px length |
INVALID_HTML_LINK_ELEMENT | <link> element | passes through | rel other than stylesheet |
ASSET_ERROR | Stylesheet inlining | passes through | A <link> stylesheet or @import failed to load |
INVALID_ASSET_REFERENCE | Render pipeline | passes through | A referenced asset failed to load |
INVALID_COUNTER | Numbering | passes through | A <Counter> missing data-name |
INVALID_COUNTER_DEF | Numbering | passes through | A <CounterDef> missing data-name |
INVALID_REF | Numbering | passes through | A <Ref> missing data-to |
INVALID_NUMBERING_RULE | Numbering | passes through | A <NumberingRule> missing data-match |
NO_LAYOUT_PROVIDED | Pagination | passes through | Document holds no Layout |
NO_PAGES_RENDERED | Pagination | passes through | A Flow had no content to lay out |
PAGE_PROGRESS_STALLED | Pagination | INTERNAL_SERVER_ERROR | Queued content that can never place |
INVALID_ENGINE_OPTIONS | Engine config | INTERNAL_SERVER_ERROR | Internal; file a bug |
INVALID_AUTORUN_OPTIONS | Engine config | INTERNAL_SERVER_ERROR | Internal; file a bug |
INTERNAL_ERROR | Engine internal | INTERNAL_SERVER_ERROR | Internal; file a bug |