Private betav0.1.0
Docs
Format developer documentation

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.

SurfaceWhat you see
StudioThe 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.
APIThe 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.

TriggerFix
No Document template in the rendered outputWrap 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.

TriggerFix
data-title missingAdd 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.

TriggerFix
data-width or data-height missingAdd 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 scaffoldingMove 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.

TriggerFix
data-id missingAdd data-id="..." to the Frame. Frame ids must be unique within the owning Layout.
Duplicate Frame id in same LayoutRename 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.

TriggerFix
Value doesn't end in pxUse a CSS px length, e.g. "793.71px". Other units are not accepted.
Value isn't a valid numberCheck 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.

A <link> element uses a rel other than stylesheet, whether it sits inside a Layout or directly under the Document.

TriggerFix
<link rel="..."> is anything other than stylesheetFormat 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.

TriggerFix
A <link> stylesheet failed to fetchConfirm the stylesheet is in your assets bundle and the href matches its path. See Assets.
An @import inside a stylesheet failed to resolveBundle 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.

TriggerFix
The path doesn't match a file in the bundleCheck the path and confirm the file ships in the bundle. See Assets.
A remote URL that wasn't bundledA 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.

CodeTriggerFix
INVALID_COUNTERA <Counter> is missing data-nameAdd data-name="..." naming the counter to act on.
INVALID_COUNTER_DEFA <CounterDef> is missing data-nameAdd data-name="..." naming the counter you are defining.
INVALID_REFA <Ref> is missing data-toAdd data-to="..." with the id of the element you reference.
INVALID_NUMBERING_RULEA <NumberingRule> is missing data-matchAdd 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.

TriggerFix
Document has no LayoutAdd 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.

TriggerFix
A Flow has no contentGive 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.

TriggerFix
Queued content that can never placeCheck 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.

TriggerFix
An option value is invalidThis 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.

TriggerFix
An autorun option value is invalidThis 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.

TriggerFix
An engine invariant brokeThis 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:

CodeSourceAPI statusMost common cause
NO_DOCUMENT_FOUNDDocumentINTERNAL_SERVER_ERRORNo data-type="document" root in the rendered output
INVALID_DOCUMENTDocumentpasses throughdata-title missing
INVALID_LAYOUTLayoutpasses throughMissing data-width / data-height, or a table of contents in the scaffolding
INVALID_FRAMEFramepasses throughMissing or duplicate data-id
INVALID_VALUEWidth / heightpasses throughValue isn't a CSS px length
INVALID_HTML_LINK_ELEMENT<link> elementpasses throughrel other than stylesheet
ASSET_ERRORStylesheet inliningpasses throughA <link> stylesheet or @import failed to load
INVALID_ASSET_REFERENCERender pipelinepasses throughA referenced asset failed to load
INVALID_COUNTERNumberingpasses throughA <Counter> missing data-name
INVALID_COUNTER_DEFNumberingpasses throughA <CounterDef> missing data-name
INVALID_REFNumberingpasses throughA <Ref> missing data-to
INVALID_NUMBERING_RULENumberingpasses throughA <NumberingRule> missing data-match
NO_LAYOUT_PROVIDEDPaginationpasses throughDocument holds no Layout
NO_PAGES_RENDEREDPaginationpasses throughA Flow had no content to lay out
PAGE_PROGRESS_STALLEDPaginationINTERNAL_SERVER_ERRORQueued content that can never place
INVALID_ENGINE_OPTIONSEngine configINTERNAL_SERVER_ERRORInternal; file a bug
INVALID_AUTORUN_OPTIONSEngine configINTERNAL_SERVER_ERRORInternal; file a bug
INTERNAL_ERROREngine internalINTERNAL_SERVER_ERRORInternal; file a bug

HTML schema reference · Document model · Assets

Was this page helpful?