Mistakes and their fixes#
The check reports each problem as a severity, a code, a JSON Pointer to the place and a message. Errors make the definition invalid; warnings mark something legal that probably does not do what you meant. Fix both. Each entry below shows a wrong fragment, what it causes, and the fix. The fragments are changes to this guide's examples.
Mistakes nothing reports#
These are not reported: the app checks clean and looks right when you try it alone. Each block below checks with no diagnostic.
A list for several people without "scope": "shared". Each person gets a list of their own, and nobody sees what the others add. Fix: give the entry "scope": "shared", with "conflict": "merge" and "key": "id" for a list of records.
JSON
{ "type": "Item[]", "initial": [], "description": "Everything on the household's list, bought or not." }
A notification that only the clock sends, on an optional permission. Nothing a person does needs the permission, so it may never be asked: the call fails with grant.denied, no error is shown, and nothing is sent. Fix: give the person a control whose action uses the permission, as "Turn on reminders" does in the plant care app, or leave the request required (see capabilities). Without that button, the plant care app, used by one person, never reminds anyone:
JSON
{ "control": "core:text", "props": { "value": "Reminders come by themselves." } }
Reading into a sourced entry before its first answer. The entry is null until the service answers: a required prop that fails draws a placeholder for its control, an optional one its default. Fix: show the node only once the answer is there ("when": "state.found" in the weather app), or read with default.
JSON
{ "control": "core:stat", "props": { "label": "Now", "value": "=`${state.forecast.body.now}°`" } }
An optional input field with no default. A caller that leaves it out leaves it absent, not empty, and the first step that reads it fails the action with expression.error. Fix: give the field a plain default, or read it with default(input.author, '').
JSON
{ "type": "string", "description": "Who wrote it.", "required": false }
A table column whose currency is "=env.currency". A host that does not know the person's currency gives null, which a column cannot hold: the table is replaced by a placeholder. Fix: leave currency out, { "field": "amount", "label": "Amount", "format": "currency" }; the host then uses the person's currency when it knows it, and a plain number when not.
JSON
{ "control": "core:table", "props": { "label": "Spent", "items": "=[{what: 'Lunch', amount: 12.5}]", "columns": [ { "field": "what", "label": "What" }, { "field": "amount", "label": "Amount", "format": "currency", "currency": "=env.currency" } ] } }
A text in the state that stands for a message. A step writes "Request sent." into an entry and a text on the screen shows it. Nothing clears it: it still says so after a later request fails, and an agent that did the work never hears it. Fix: give the action done (see actions); the person sees its message for a moment, and whoever started the action hears it.
JSON
[
{ "op": "add", "path": "/state/notice", "value": { "type": "string", "initial": "", "description": "What the app last said." } },
{ "op": "add", "path": "/actions/askForTimeOff/steps/2", "value": { "set": "state.notice", "to": "Request sent." } },
{ "op": "add", "path": "/surfaces/visual/views/mine/body/children/0", "value": { "control": "core:text", "props": { "value": "=state.notice" } } }
]
A row above a control that holds a heading and a button, to stand in for its header. It is a row of its own: the button is not announced as the control's, and on a narrow screen it can wrap away from the title. Fix: put the button in the control's actions slot, as the weather app's list of days does (see views). This row above that list checks clean:
JSON
{ "control": "core:stack", "props": { "direction": "horizontal" }, "children": [ { "control": "core:heading", "props": { "value": "Next days", "level": 3 } }, { "control": "core:button", "props": { "label": "Refresh", "icon": "refresh" }, "on": { "press": { "refresh": "state.forecast" } } } ] }
A picker drawn as shapes on a canvas. Circles on a core:canvas as colors, or squares as tools: a canvas grows with its column, so a dot can be a hand wide, and one picture is no radio group: a screen reader cannot tell the options apart, nor the keyboard move between them. Fix: a core:choice whose options carry swatch or icon (see controls); a canvas's tools go in its tools slot.
JSON
{ "control": "core:canvas", "props": { "label": "Pen color", "aspect": 5, "scene": [ { "kind": "circle", "x": 0.1, "y": 0.5, "r": 0.08, "fill": "text" }, { "kind": "circle", "x": 0.3, "y": 0.5, "r": 0.08, "fill": "accent" } ] } }
A pen stroke drawn as one line per move. A scene that makes a line of each pair of a stroke's points costs about 40 units of the expression budget for each point, and a canvas draws at most 5000 shapes: within a minute of drawing, the canvas is replaced by a note, its tools and actions with it, or new strokes are not drawn. Fix: one path for each stroke, whose cost does not grow with its points, and an eraser by event.target (see controls).
flatten(state.ink.map(s, range(size(s.points) - 1).map(i, {kind: 'line', x: s.points[i].x, y: s.points[i].y, x2: s.points[i + 1].x, y2: s.points[i + 1].y})))
A curve or a round shape made of many points. A circle as a path of points, corners rounded with points, or a gauge of dozens of short lines: each point counts against the canvas's 50000 and costs budget, and edges blur on a large canvas. Fix: an ellipse, a rect with radius, an arc, or a path whose points carry control points (see controls).
A rule that fires many times a second to make motion look smooth. A game that moves a piece a cell every 300 ms but ticks every 50 ms to slide it works twenty times a second, sends its whole scene each time, and still steps. Fix: a rule at the pace of the game, and motion on the canvas or on the piece, with an id on the piece; { "over": "PT0.3S", "ease": "linear" } glides it at an even speed (see controls). A figure drawn again and again, such as a block, is a symbol placed by use.
Up and down buttons on each row of a list a person puts in order. Two buttons on each row to move it a place up or down fill every row, cannot be dragged, and take a press for each place. Fix: make the list reorderable and keep the order move gives (see controls); the host offers each row a Move control that moves it up or down, and dragging where it can.
Arrow buttons that move an item from list to list. Back and forward buttons on each card fill every card, cannot be dragged, and take a press for each column. Fix: give the columns one moveGroup and a move handler that changes the field they filter on (see controls); the host offers each card a Move control naming the other columns, and dragging where it can.
One section written by hand for each item of the app's data. The navigation keeps the notebooks there were when it was written: one made later never gets a section, and one taken away keeps a section that opens an empty page. Fix: one section with each over the list, as the notes app does (see views).
JSON
[
{ "view": "notebook", "with": { "id": "work" }, "label": "Work", "icon": "file" },
{ "view": "notebook", "with": { "id": "home" }, "label": "Home", "icon": "file" },
{ "view": "newNotebook", "label": "New notebook", "icon": "add" }
]
Records in the navigation. Every note as a main section: the navigation grows with the data until a host shows only the first ones and how many more there are, and a person cannot search, sort or act on them there. Fix: keep records in a list inside a view, as the notebook's view lists its notes, and repeat sections only for places a person goes to and stays in.
JSON
{ "each": { "in": "state.notes", "as": "n", "key": "n.id" }, "view": "notebook", "with": { "id": "=n.notebook" }, "label": "=n.text", "icon": "file" }
A part that exports an action which writes an input its parent drives. The jar exporting setGoal: alone it works, but inside the gift fund, whose with drives the goal, every run fails with state.readonly. Fix: export only actions that leave driven inputs alone; the parent changes the input through what it gives in with (see parts).
JSON
["putIn", "setGoal"]
The same long formula written in several places. A change made to one copy and not the others goes unseen. Fix: a derived state entry when it takes no input, a code module when it does (see code).
"1 pieces". A count beside a noun needs plural: plural(size(state.books), {one: 'book', other: 'books'}), in an app in one language too.
The document#
schema.invalid: a key the format does not have, a required key left out, or a value of the wrong shape. The commonest: an action without description.
JSON
{ "steps": [ { "set": "state.glasses", "to": "=state.today + 1" } ] }
Fix: add the missing key, or remove or rename the unknown one. The message names it.
A step the format does not have is the same mistake, such as one that would show a message after the form is sent:
JSON
{ "toast": "Request sent." }
Fix: no step shows a message. Give the action done with the words, and the host shows them to the person who pressed.
contract.unknown: a core: name with no core entry in uses.catalogs, or a control or capability the catalog does not have.
JSON
{ "catalogs": {} }
Fix: add the uses block of the smallest app (see start), and take names from controls and capabilities.
Expressions#
expression.syntax: an expression that does not parse. Often an = in a field that is always an expression:
JSON
"=state.glasses"
Fix: no = in derive, when, if, allow, where, becomes, that.
reference.unknownState: a state entry that does not exist, usually a typo.
JSON
"state.glass"
expression.unknownRoot: a name that is not available at that place, such as input in a derive, or a local name used outside its step list.
JSON
"input.count"
expression.unknownMember: a field a closed type does not have, such as a misspelt record field.
JSON
"state.books.count(b, b.staus == 'toRead')"
expression.typeMismatch: a value of the wrong kind: text joined to a number with +, a list where a condition is expected, a list where a number is declared.
JSON
"=state.today + ' of ' + state.goal"
Fix: a template, "=`${state.today} of ${state.goal}`"; a comparison, size(state.books) > 0; a derive whose value fits the type.
expression.effectNotAllowed: uuid() or random() outside a step, or can and canSend in a guard or a derive.
JSON
[ { "that": "canSend('approval', 'cancel', input.id)", "message": "Only a waiting request of yours can be taken back." } ]
Fix: write the condition itself in the guard; use can and canSend in views.
Writing state#
write.sharedDirect: a screen writes shared state directly. Fix: run an action that writes it.
JSON
{ "set": "state.items", "to": [] }
view.handlerStep: a handler holds a call, send, emit, code or return. Fix: move the step into an action and run it.
JSON
{ "call": "notify.send", "with": { "title": "Reminders are on" } }
Names and inputs#
field.missing: a with that leaves out a field the target requires: an action's input, an operation's input or a view's input.
JSON
{ "navigate": "book" }
Controls#
prop.unknown and prop.missing: a prop the control does not have, or a required prop left out. Take prop names from controls.
JSON
{ "text": "I drank a glass" }
This fragment causes both codes: text is unknown, and the required label is missing.
The message of prop.unknown names the props the control has. A text field's example text is its hint, not "placeholder":
JSON
{ "label": "Title", "required": true, "placeholder": "Such as Middlemarch" }
Fix: "hint": "Such as Middlemarch".
A chart's names are its own: what the values are is valueLabel, not "yLabel", with unit for what they count; the categories are categoryLabel, not "xLabel"; a target line is goal, not "target"; and a series has no "kind", as one chart draws one kind. The message lists the chart's props:
JSON
{ "control": "core:chart", "props": { "kind": "bar", "label": "Glasses by day", "category": "day", "items": [{ "day": "Mon", "glasses": 6 }], "series": [{ "field": "glasses", "label": "Glasses" }], "yLabel": "Glasses", "target": 8 } }
Fix: "valueLabel": "Glasses", "unit": "glasses", "goal": { "value": 8, "label": "Daily goal" }.
value.notKnown (warning) on an icon: a name the hosts do not know, such as "graph". It is still a valid value, so nothing fails, but the web host draws no symbol: the button shows its label alone, even with "iconOnly": true. The message gives the nearest known names. Fix: a known name, such as "chart"; controls lists them, and so does oad catalog under IconName.
JSON
{ "label": "I drank a glass", "icon": "graph" }
view.headingRepeatsTitle (warning): the view begins with a heading that says its title again. The host already draws the title as the page's or card's heading, so the words show twice. Fix: remove the heading.
JSON
{ "control": "core:heading", "props": { "value": "Water today" } }
prop.markdownInPlainText (warning): a plain core:text holds words written in Markdown (two asterisks around words, lines that start with a hash or a dash, a link written as words in brackets followed by an address), so the person sees the marks. Fix: write the words plainly, with style or a core:heading for what should stand out; when the text really is formatted, give it "format": "markdown".
JSON
{ "control": "core:text", "props": { "value": "Drink **eight** glasses a day." } }
Capabilities and grants#
grant.uncovered: an operation is called, or read as a source, with no grant request for its scope.
JSON
{}
state.sensitivityUnstated (warning): a source on a scope of high sensitivity without sensitive. Fix: say "sensitive": true or "sensitive": false.
trigger.noBackground (warning): an every rule, or a flow's after timer, with no grant on a background capability. It runs only while the app is open.
JSON
{ "tick": { "description": "Checks the count every minute.", "when": { "every": "PT1M" }, "do": [] } }
Fix: add "foreground": true beside every when that is what you mean, or ask for core:scheduler (see capabilities).
Parts#
part.notExported: the parent reads, runs, hears or places something the part does not list in its exports. Fix: add it to the part's exports, or use what the part exports.
JSON
"ceil(parts.jar.state.goal / 20)"
action.unknown for a part's action run without the part's name. Fix: jar.putIn, the part's name, a dot and the action.
JSON
[ { "run": "putIn", "with": { "amount": 20 } } ]
part.unknownDefinition: a part's definition names the app or its id, not the alias under uses.definitions. Fix: "definition": "jarApp".
JSON
"jar"
Other codes the check reports#
| Code | Cause | Fix |
|---|---|---|
reference. |
An input field the action does not declare. |
Declare it, or fix the name. |
value.typeMismatch |
A literal that does not fit its type, such as "eight" for an integer, or an expression as an input field's default. |
Write a value of the type; a default is never an expression (see expressions). |
type.unresolved |
A type name not declared under types, or a misspelt primitive. |
Declare the type, or fix the name. |
state.readonly |
A step or binding writes a derived or sourced entry. | Write the stored entries it reads. |
action.unknown |
A run or can of an action that does not exist. |
Fix the name. |
field.unknown |
A with names a field the action, operation or view does not take. |
Use the names its input declares. |
event.unknown |
A handler for an event the control does not raise, such as click on a button. | Take event names from controls (press). |
slot.unknown |
A slot the control does not have, such as actions on a core:stat. |
Put the actions in a group around it, or a button beside it. |
prop. |
A button with "iconOnly": true and no icon: its label is shown. |
Give it an icon; its label stays its name. |
grant.unknownScope, operation.unknown |
A scope or an operation the contract does not have. | Take names from capabilities. |
action. |
A rule, a flow or an action without confirm runs an action that has one. |
Let a person run it from a screen. |
flow.fieldWrite |
A step writes the field that holds a flow's stage. | Move the stage with send. |
flow.unknownEvent |
A send of an event no stage of the flow handles. |
Fix the name. |
export.notStored |
An exported input whose path is not a stored entry, such as "goal" for "state.goal". |
Give the path of a stored entry, such as state.goal. |
view.tabUnnamed (warning) |
A child of core:tabs with nothing to name its tab, such as a plain core:stack. |
Wrap it in a core:group with a title (see views). |
Texts in several languages#
| Mistake | What you see | Fix |
|---|---|---|
| A key added to a translation only | localization. |
Add it to the default table first. |
| A fixed place naming a text with a blank | localization. |
Name a plain text. |
| A sentence joined from translated pieces | Words out of order; nothing reported | One entry with blanks (see languages). |
When the app runs#
These come from a running app, not from the check. The person or agent sees the code and a message.
| Code | Cause | Fix |
|---|---|---|
action.invalidInput |
Missing, unknown or wrongly typed input. | Pass what the action's input declares. |
action.forbidden |
allow was not true, or the caller has no access. |
Expected for callers who may not act; give the reason with require instead where the caller can put it right. |
action.refused |
A require entry was not true; carries its message. |
Expected; make the message say what to change. |
action.declined |
The person said no to a confirm. |
Expected. |
grant.denied |
No permission covers the call: declined, or never asked. | Handle it with onError when the request is optional. |
expression.error |
An expression failed, such as reading a missing optional input. | Read it with default or test it with has, or give the field a default. |
state.invalidValue |
A write that does not fit the entry's type. | Make the value fit, or widen the type. |
state.noElement |
A selector found no element. | Check that the element exists, in a require. |
flow.forbidden |
A transition's allow was not true. |
Expected; check with canSend before offering it. |
flow.noTransition |
The element is not in a state that takes the event. | Offer the event only where canSend is true. |
Next#
startfor how to work and the rules of thumb.expressions,state,actions,viewsandcapabilitiesfor each area in full.partsfor an app that includes another.