What a render reports
Your page came back. Something on it is not what you asked for: a card is missing, the colors are gone, a list is shorter than the one in the database. Nothing threw, nothing logged an error, and the page looks finished.
Loom told you. It told you in the second thing every render hands back, and this page is the whole list of what it can say.
Rendering never fails, so it reports instead
A render always returns an element. That is a promise rather than a happy accident, and it is the reason this list exists at all: a tree can name a card you have not registered, and blanking the whole page over one card serves nobody.
So anything the render could not honor comes back beside the element:
import { renderLoomTree } from "@jam-overture/loom/react"
const { element, diagnostics } = renderLoomTree(tree, options)
diagnostics is a list. On a healthy render it is empty. Every entry carries
the id of the node it happened at, and most carry the primitive's type as well,
so each one points at a place in the tree rather than at the page in general.
There are twenty-four things it can say. Every one of them below was produced by a render that said it, as this page was built.
The first question is whose problem it is
This is the part worth learning before the list. A diagnostic is addressed to somebody, and there are only three candidates:
- Whoever wrote the tree. A node names a primitive, a prop, a region or an anchor that the registry does not back up. These are the ones a proposal can cause, which is exactly why you write a policy.
- Whoever wired the render. The tree is fine and a seam around it is missing something: a registry, a resolution, an allowlist, one dictionary entry. All of these are fixed in the code that calls the render.
- Whoever wrote the primitive. One code, and it is in a group of its own because nothing a tree says and nothing you wire can cause it.
The list below is grouped that way, because "which file do I open" is the question you actually have.
Read it as the render's first complaint
A diagnostic list is not an audit. It is what this render ran into, and one mistake can hide another.
Take one unregistered primitive, holding one text node, under two roots that differ only in their props:
| the root | what came back |
|---|---|
a valid loom.page | ["unknown-primitive"] |
a loom.page whose props are refused | ["invalid-props"] |
Both trees contain the same unregistered node. The second does not mention it, because the node above it was never called, and a component that was not called renders no children for the walk to reach.
That is the right behavior and it has one consequence for you:
expect(rendered.diagnostics).toEqual([])
An empty list means nothing was wrong and everything was reached. Nothing weaker than that has a single meaning, so this is the assertion to write rather than counting entries or checking for a particular code.
The four you will meet first
These are the four a page runs into while somebody is still building it.
The tree names a primitive you have not registered
unknown-primitive
A proposal invented a type, or a deployment rolled the code back and left the tree where it was.
What the runtime says
no primitive is registered for "loom.sparkline", so node n_unknown1 and its subtree were omitted
Whose problem it is: the tree. Register it, or change the node. The node and everything under it was left out, so this is the diagnostic most likely to be a visible hole in the page.
A node's props are not what its primitive declared
invalid-props
A heading with a level of eleven. The schema is the allowlist, and this is it refusing.
What the runtime says
node n_invalidprops2 does not satisfy the props declared by "loom.heading", so it and its subtree were omitted — level: Number must be less than or equal to 6
Whose problem it is: the tree. Read the issues on the diagnostic. Each one names a path and what was wrong with the value at it. The node and its subtree were omitted, the same as an unknown primitive.
The theme on the root is not one you registered
theme-unresolved
Three ids on the root, and one of them names a palette nobody registered.
What the runtime says
the theme named by node n_badtheme3 could not be resolved, so the tree rendered unstyled — No palette "sunset". Registered: slate, sage, linen, dusk, paper (nearest 5 of 21).
Whose problem it is: the tree. The registry is the allowlist, so this is a proposal naming something outside it or a deployment that registered fewer palettes than its trees name. The page rendered unstyled, which looks like a stylesheet that failed to load.
A node asks for data and this render was given none
data-unresolved
`renderLoomTree` was called directly, without resolving the tree's bindings first. Or with a resolution built from a different tree.
What the runtime says
node n_unresolved1 asks for data and this render was given no resolution, so it rendered with none
Whose problem it is: your wiring. Resolve before you render: `resolveTreeData`, or `renderRequest`, which does it for you. The diagnostic says which of the two happened, because `absent` and `unrelated` are fixed on different lines.
All of them
Grouped by who has to act, and each one produced by a render that reports it. The node ids are this page's own benches, so they are the ids a real render would hand you, from trees nobody will ever see.
The tree asked for something it cannot have
A node names a primitive, a prop, a region or an anchor that the registry does not back up. These are the ones a proposal can cause, so they are the ones a policy is there to bound. They are fixed in the tree or in the registry.
The tree names a primitive you have not registered
unknown-primitive
A proposal invented a type, or a deployment rolled the code back and left the tree where it was.
What the runtime says
no primitive is registered for "loom.sparkline", so node n_unknown1 and its subtree were omitted
Whose problem it is: the tree. Register it, or change the node. The node and everything under it was left out, so this is the diagnostic most likely to be a visible hole in the page.
A node's props are not what its primitive declared
invalid-props
A heading with a level of eleven. The schema is the allowlist, and this is it refusing.
What the runtime says
node n_invalidprops2 does not satisfy the props declared by "loom.heading", so it and its subtree were omitted — level: Number must be less than or equal to 6
Whose problem it is: the tree. Read the issues on the diagnostic. Each one names a path and what was wrong with the value at it. The node and its subtree were omitted, the same as an unknown primitive.
The theme on the root is not one you registered
theme-unresolved
Three ids on the root, and one of them names a palette nobody registered.
What the runtime says
the theme named by node n_badtheme3 could not be resolved, so the tree rendered unstyled — No palette "sunset". Registered: slate, sage, linen, dusk, paper (nearest 5 of 21).
Whose problem it is: the tree. The registry is the allowlist, so this is a proposal naming something outside it or a deployment that registered fewer palettes than its trees name. The page rendered unstyled, which looks like a stylesheet that failed to load.
A theme below the root, which is not mounted
theme-misplaced
A section half way down the page names its own palette.
What the runtime says
node n_misplaced3 names a theme and is not the root, so it was ignored — a theme is mounted once, at the render root
Whose problem it is: the tree. Move it to the root or take it off. A theme is mounted once, on the render root, so a selection anywhere else is read by nothing. It is reported rather than dropped because somebody meant it.
A `loom:` prop the runtime does not read
reserved-prop-unrecognised
A typo in a reserved key, or a key from a version of the runtime this deployment is not running.
What the runtime says
node n_reserved2 carries "loom:them", which is in the runtime's reserved namespace and is read by nothing, so it was dropped
Whose problem it is: the tree. The `loom:` namespace is the runtime's own, so a key in it that nothing reads is dropped rather than handed to your component. Check the spelling against the reserved props the runtime publishes.
A region the primitive places nowhere
slot-unplaced
A node fills a region called `sidebar` and its primitive places `meta` and nothing else. The content rendered and was then mounted by nobody.
What the runtime says
node n_unplaced4 fills the region "sidebar" and "loom.article" places no region of that name, so the content and everything under it was dropped
Whose problem it is: the tree. The expensive one to miss: words somebody wrote are gone and the page still looks finished. Ask the registry which regions the primitive places, with `slotsPlacedBy`, and fill one of those.
`loom:data` that is not a map of names to sources
data-misdeclared
A binding written as a string where the seam wants an object naming a source.
What the runtime says
node n_misdeclared1 declares data that is not a map of binding names to sources, so it rendered with none — loom:data: Expected object, received string
Whose problem it is: the tree. The node rendered with no data at all, which is what a primitive's unavailable region is for. The diagnostic carries the parse error, so it says which part of the declaration was wrong.
An answer arrived under a name nothing reads
data-unread
The tree binds under `items` and the primitive reads `entries`. The source answered perfectly and the answer was dropped on the floor.
What the runtime says
node n_unread1 binds "items" and "loom.feed" does not read a binding of that name, so the answer was resolved and then read by nobody
Whose problem it is: the tree. Bind under the name the primitive declared. This is the one that costs a round trip and draws an empty region, so it looks like a source with no rows in it.
`loom:submit` that is not an endpoint id
submit-misdeclared
A form declaring a URL where the seam wants the id of an endpoint your app registered.
What the runtime says
node n_submitbad1 declares a submission that is not an endpoint id under `to`, so it rendered with no target — to: Invalid
Whose problem it is: the tree. A form in a tree names a destination and never carries one. Put the id of a registered endpoint under `to` and let your own code decide what that resolves to.
An anchor a link could not carry
anchor-unusable
`loom:anchor` holding a sentence with spaces in it, rather than a slug.
What the runtime says
node n_anchorbad2 names an anchor a link could not carry, so it is not a fragment target — "terms and conditions" is not lowercase letters, digits and single hyphens
Whose problem it is: the tree. The node rendered exactly as it would have and is simply not a fragment target. The diagnostic says which rule the value broke: empty, too long, or spelled with something that does not survive a URL.
Two nodes asking for the same anchor
anchor-claimed
A page with two sections both called `terms`, which a deployment gets by duplicating a band.
What the runtime says
node n_anchortwice4 names the anchor "terms" and node n_anchortwice2 already holds it, so only the first one is a fragment target
Whose problem it is: the tree. The first in document order keeps it. Two elements sharing an id is a document the browser resolves by its own rule, and a link that lands on whichever one the parser preferred is worse than one node that cannot be linked to.
The render was not given everything it needed
The tree is fine. The seams around it are missing something: a registry, a resolution, an allowlist, a dictionary entry. Every one of these is fixed in the composition root, which is the code that calls the render.
You resolved a primitive you cannot check
props-undeclared
The resolver knows the type and the validator does not, which happens when a deployment wires a registry into one and a plain map into the other.
What the runtime says
no prop schema is registered for "loom.prose", so node n_undeclared2 rendered with unchecked props
Whose problem it is: your wiring. Pass the same registry to both options. The node rendered, which is the problem: its props were never checked, so the next invalid one will reach the component instead of being refused.
The tree names a theme and you passed no registry
theme-unregistered
The `themes` option was left out, and the root asks for three ids all the same.
What the runtime says
node n_notheme1 names a theme and no theme registry was supplied, so the tree rendered unstyled
Whose problem it is: your wiring. Pass a `ThemeRegistry`. Leaving it out is legal and renders, so this is the diagnostic that tells you why a page a designer signed off on arrives with none of its colours.
A question your app could not answer
data-unavailable
The source is registered and it refused, timed out, or answered with something that fails its own schema.
What the runtime says
node n_unavailable1 binds "entries" to "bench.missing" and it could not be answered — no source is registered for it — registered: none
Whose problem it is: your wiring. This is the ordinary state of an integration being down, and the page is right to still be here. The diagnostic names the binding, the source and the reason, which is the line to log.
A node asks for data and this render was given none
data-unresolved
`renderLoomTree` was called directly, without resolving the tree's bindings first. Or with a resolution built from a different tree.
What the runtime says
node n_unresolved1 asks for data and this render was given no resolution, so it rendered with none
Whose problem it is: your wiring. Resolve before you render: `resolveTreeData`, or `renderRequest`, which does it for you. The diagnostic says which of the two happened, because `absent` and `unrelated` are fixed on different lines.
Rows arrived and the primitive drew fewer than it was given
data-unshown
Twelve rows came back and one of them has a column the primitive cannot read, so eleven were drawn.
What the runtime says
node n_unshown1 was answered 2 rows under "entries" and "loom.feed" showed 1 of them, so the rest arrived and were not drawn
Whose problem it is: your wiring. Nothing on the page says so. The reader sees a shorter list. Both counts are on the diagnostic, so this is the one to watch after a change to the query behind the source.
A form whose endpoint could not give it a target
submit-unavailable
The endpoint is registered and it refused this visitor, threw, or answered with a target the seam will not carry.
What the runtime says
node n_submitrefused1 posts to "trouble.refused" and no target could be given for it — the endpoint refused — this form is closed to signed-out visitors
Whose problem it is: your wiring. The page is still here and the form says it cannot be sent right now, which is the trade every diagnostic here makes. The reason is on the diagnostic rather than on the page, because none of the reasons is something a visitor could act on.
A form names an endpoint and this render has no target for it
submit-unresolved
The data seam's twin, one node over: nothing resolved the tree's submissions before the walk.
What the runtime says
node n_submitnone1 names an endpoint and this render was given no resolution, so it rendered with no target
Whose problem it is: your wiring. Resolve with `resolveTreeSubmissions`, or render through `renderRequest`. Until then the form renders with nowhere to post, which is the failure the whole seam exists to prevent.
A frame this deployment will not load
frame-refused
No allowlist was wired, so every framable prop is refused. The seam fails closed.
What the runtime says
node n_framenone1 frames "src" and it will not be framed — this render was given no framable origins — "https://video.example.com" was not checked against anything
Whose problem it is: your wiring. Register the origins you are willing to frame. The registry is the allowlist, and a deployment that has not written one has not agreed to run anybody's script inside its pages.
A frame from your own origin, whose sandbox grants it nothing
frame-same-origin
The document in the frame comes from the origin this deployment registered as its own, so `allow-scripts` beside `allow-same-origin` is a boundary between one origin and itself.
What the runtime says
node n_frameself1 frames "src" from "https://loom.example", which this deployment registered as its own, so the frame's sandbox grants it nothing it did not already have
Whose problem it is: your wiring. Not a refusal, and usually deliberate. It is reported because it is the one thing about a frame that looks contained and is not. The decision is yours to make knowingly rather than by default.
A control left out because it had no name
behaviour-unnamed
A dictionary answers one of a primitive's declared strings with blank space, and that string was what a control is announced by.
What the runtime says
node n_unnamed2 takes the "copy" behaviour and "copied" resolved to nothing, so the control was left out rather than rendered with no accessible name
Whose problem it is: your wiring. Fix the dictionary entry the diagnostic names. The control was left out rather than rendered unnamed, because a button a screen reader announces as “button” is worse than no button.
You asked for values and no theme mounted
theme-values-unmounted
A render for a medium with no cascade, such as an image or an email, on a tree whose root mounted no theme.
What the runtime says
this render was asked for the theme's values and node n_literals3 mounted no theme, so every reference on the page was left as written — nothing outside a browser will resolve them
Whose problem it is: your wiring. Give the tree a theme, or do not ask for literals. Every reference on the page was left as written, and nothing outside a browser will resolve one.
An excerpt of a node that is not there
excerpt-absent
A review queue, a link in a record or a URL names a node, and an ordinary change removed it since.
What the runtime says
an excerpt was asked for node n_gone and this tree holds no such node, so nothing was rendered — the id may name a part a later revision removed
Whose problem it is: your wiring. The one case here where nothing rendered, because there was nothing to render. Treat it as a part that has moved on rather than as an error: the id was valid when somebody wrote it down.
A primitive did something it promised not to
One code, and it is here because it is addressed to somebody else entirely: whoever wrote the component. Nothing a tree says and nothing a deployment wires can cause it.
A primitive could not say what it dropped
unshown-unreadable
A component declares a reading of the answer it was handed, and the declaration threw or returned something that cannot describe an answer.
What the runtime says
node n_broken1 is drawn by "bench.broken-reporter", which says what it could not show and could not be believed, so nothing was reported of what it dropped — the declaration threw — the reader of this answer is not written yet
Whose problem it is: the component. The one fault here that is neither your tree nor your wiring: the component's bookkeeping is wrong. The node rendered exactly as it would have, because a page lost to bookkeeping would be the worst trade available.
One of these needed a component written to be wrong
unshown-unreadable is the only code in the list that neither a tree nor a
deployment can cause, which means no page could demonstrate it with the starter
library: every primitive in it that reports what it dropped works out the figure
from the answer it was handed.
So there is a component in this site's own test bench, called
bench.broken-reporter, whose job is to throw while reporting. It is not
registered anywhere a reader can reach and it is not part of the library you
installed. It is here because the alternative was to describe this one in prose
and leave it unproved, which is the thing every other row on this page is not.
What to do with them
Three habits, and they are the same three on every deployment that has had this go wrong once.
- Show them in development. Under every example on this site there is a list of the diagnostics that example produced, which is empty. A render whose diagnostics nobody looks at is a page that can degrade silently for weeks.
- Log them in production, with the node id. The id is what makes a diagnostic actionable six weeks later, and it is what joins one to the change that introduced it.
- Fail a test on them. An empty list is a cheap assertion with a strong meaning, and it catches the whole class before a reader does.
The one to treat differently is slot-unplaced. Everything else here costs
appearance, latency or a check you did not get. That one costs words somebody
wrote, on a page that still looks finished, and nothing a reader sees says so.