Reference

Errors

What the legato tool and its MCP server refuse, and the problems Legato shows on a page whose file has a mistake.

There are two places a mistake shows up:

  • The legato tool and its MCP server refuse a write or a read with an error envelope. See Tool errors.
  • The page itself. Legato reads every file in the Pages folder, however it was written. A file it can't use still shows in the sidebar, as a page that says what's wrong. See Problems on a page.

Tool errors

Every refusal has the same shape. Check code to decide what to do; message says what happened in plain language:

json
{
  "error": {
    "code": "version_mismatch",
    "message": "The page has changed since that version; read it again before replacing it.",
    "details": { "current_version": "9f2c41d07ab35e88" }
  }
}
  • code is stable. Branch on it.
  • message is for people and may change. For invalid_page it's often Legato's own description of the problem, which is what to fix.
  • details is there only for some codes. It's an object of strings: current_version for version_mismatch, and page and saved for validation or loading failures. saved: "false" means validation refused the write; saved: "true" means the file was written but the running app rejected it.

How each way of calling the tool returns it:

Called asA refusal is
legato set, get, list, delete, schemaThe envelope on stdout, and exit status 1.
An MCP tool (set_page, get_page, …)A tool result with isError: true, carrying the envelope as its text and as structuredContent.

An unknown legato subcommand isn't a refusal: the tool prints its usage on stderr and exits with status 2, with nothing on stdout.

Codes

codeMeansDo
invalid_page_idThe id isn't a page id: it has a path, starts with a dot, or ends in .json. Or it names a new page and isn't 1–64 lowercase letters, digits and hyphens, starting with a letter or digit. An existing file with another name, such as Budget 2.json, can still be read, replaced and deleted by that name.Pick an id like budget. See Limits.
invalid_pageThe page can't be used. Before writing: a top-level key that isn't a page field, no title, no cards (or an empty list), or, from legato set, input that isn't a JSON object. Or Legato's own parser, run before anything is written, found a mistake, and message is its description, as in budget.json: /cards/2: a stat card needs value. Nothing was written (details.saved is "false").Fix what the message names and send the whole page again.
load_failedThe page passed the check and was saved, but the Legato that's running couldn't load it (a running app older or newer than the tool). details.saved is "true": the file holds your page.Quit and reopen Legato so the app and the tool match, or fix what the message names and send the page again.
validation_unavailableThe tool couldn't run Legato's page check (the app beside the tool is missing or damaged). Nothing was written.Reinstall Legato, so the app and its legato tool come from the same build.
too_largeThe page is over 1 MB once written as a file. get_page gives the same code for a file in the folder that's already over 1 MB.Send less: shorter lists, fewer cards.
version_mismatchYou sent --if-match (or if_match), and the page isn't at that version. details.current_version is its version now, or none if there's no such page any more.Read the page again, rebuild, and retry with the new version.
not_foundget or delete named a page that isn't in the folder.Check the id; list shows the pages there are.
write_failedThe file couldn't be saved in the Pages folder (permissions, a full disk). message gives the system's reason.Fix the folder, then retry.
delete_failedThe file couldn't be moved to the Trash.Retry, or remove it in Finder.
schema_unavailableschema (get_page_schema) found no copy of the page schema.Open Legato once, so it installs the schema, and retry.
unknown_partschema was asked for a part that doesn't exist. message lists the parts.Ask for page, sources, notify or a card type.
invalid_argumentsThe arguments don't fit: on the command line, --if-match without a version, a command without a page id, or a file that can't be read; from preview_page, both or neither of page_id and page, or no sample.Fix the command, or the call.
no_sourcespreview_page (legato preview) was given a page with no named sources to fill its cards from.Give the page sources, and its cards a source with ref, or skip the preview for a page you write yourself.
choose_sourcepreview_page was given a page with more than one source and no source. details.sources names them.Call again with source set to one of them.
unknown_sourcepreview_page's source isn't one of the page's sources. details.sources names them.Use one of those names.
invalid_samplepreview_page's sample isn't that source's answer: for named requests, an object with each request's answer under its name; for a text answer, a string.Send the answer in that shape. message says which part is missing.
preview_unavailableThe tool couldn't run Legato's source preview (the app beside the tool is missing or damaged). Nothing was saved.Reinstall Legato, so the app and its legato tool come from the same build.
turned_offFrom the MCP server only: the tool is off in Settings → Agent Access, and the message names the switch. The legato command never gives it.Ask the person at the Mac to turn it on.
failedAnything else, with the system's message.Retry; if it keeps happening, the message says why.

Validation and loading

set and set_page validate the complete page with the bundled app's file parser before changing a file. That includes each card's source, actions and itemAction: a card Legato would show as an error, such as one whose source sets empty on the shared source instead of its own, is refused too. Invalid pages return invalid_page with details {"page": "<id>", "saved": "false"}. If the validator is missing or fails, validation_unavailable leaves the file unchanged; reinstall the matching app and tool.

After a valid save, the tool opens Legato in the background if needed and waits for its load result: about 4 seconds, or 10 when it had to open the app. If a different running build rejects the validated bytes, load_failed reports {"page": "<id>", "saved": "true"}. Read the current page and fix the reported problem. The tool never rolls back a save, so it cannot overwrite another writer's changes while undoing its own.

Two answers aren't errors, but say the page isn't showing yet:

AnswerMeansDo
"loaded": null, with a noteLegato didn't confirm the load in time, or isn't running (it loads the page when it opens). The page is saved.Call get_page later: its status says whether Legato loaded it.
"loaded": {"ok": true, "plan": "locked", …}Saved and loaded, but Legato isn't showing pages: the trial hasn't started, it has ended, or the license has.Nothing to fix in the page. Tell the person to open Settings → License. See License.

list (list_pages) leaves out a file over 1 MB; get on it answers too_large.

MCP protocol errors

Before a tool runs, the MCP server can answer with a JSON-RPC error:

CodeMeans
-32700A line that isn't JSON.
-32600A message that isn't a request.
-32601An unknown method.
-32602tools/call without a tool name, or with a tool that doesn't exist.

The server reads one JSON-RPC message per line on stdin and writes one per line on stdout.

Problems on a page

Legato never drops a file it can't use. After each load it writes Pages/.status/<id>.json, which is what the tool reads:

json
{ "ok": false, "error": "budget.json: title must be 1–60 characters", "loadedAt": "2026-10-27T14:02:11.204Z", "page": "local:budget" }

ok is true for a page that loaded, with "error": null. "plan": "locked" is added while Legato needs a license. version (the first 16 hex characters of the SHA-256 of the bytes Legato read) says which save the status is about. A program that writes files directly can wait for its own version here to see whether its write took. legato get returns the same thing as status, and legato list as ok and error on each page.

A mistake shows in one of two ways: the whole page, or one card.

The whole page

When the file can't be used at all, the page keeps its sidebar row, named after the file, and shows one warning card, Can't read this page, with the file name and what's wrong. Paths are JSON Pointers into the file, so /cards/2 is the third card.

MessageFix
larger than 1 MBMake the file smaller.
not valid JSON, a page is a JSON objectFix the JSON.
“light” isn't a page field; …Remove the key. A page has title, icon, cards, sources, notify, $schema and schema_version, and nothing else.
title must be 1–60 charactersAdd or shorten the title.
cards must list 1 to 24 cardsAdd a card, or remove some.
a page holds 120 cards at most, counting those in tabs; …Every card counts toward the 120, those in tabs included. Split the page.
schema_version must be 1 (or omitted)Use 1, or leave it out.
sources must be an object of named sourcessources is an object keyed by name, not a list.
sources.<name> must be an object under a lowercase source nameSource names are lowercase letters, digits, _ and -.
sources.<name> defines a source; put ref and map on its cardsA shared source can't have ref or map; those go on the cards that use it. See Source fields.
notify needs an id (…) and a body of 1–200 characters, …See the notify field.
/cards/2 must be an object, /cards/2 needs an idEach card is an object with an id.
/cards/2: duplicate id "spend"Card ids are unique on the page, including cards in tabs.
/cards/2: “stats” isn't a card type; the types are …Use one of the card types.
/cards/2: a stat card needs valueA required field is missing.
/cards/2: label is the wrong kind of value for a stat cardA field has the wrong type, such as a number where text goes.
/cards/2: items/0: start must be a date (YYYY-MM-DD) or a date-time with seconds and a zoneA value is in the wrong format. Other examples: color must be #RRGGBB.
/cards/2/tabs must list 2 to 5 tabsSee tabs.
/cards/2/tabs/0 needs a label of 1–24 characters and 1 to 12 cardsEach tab has a label and cards, and nothing else.
/cards/2/tabs/0/cards/1: a tab holds any card but tabs and headingMove that card out of the tab.
/cards/2: a tabs card has no source or actions; …Put the source and buttons on the cards inside its tabs.

Fields a card fills from a source aren't checked here, since the source supplies them. They're checked when the answer arrives (see below).

One card

A mistake in a card's source, actions or itemAction leaves the rest of the page working. That card shows as a warning with the message in place of its content:

MessageFix
/cards/1/source.ref must name an entry in this page's sourcesAdd the source under sources, or fix the name.
/cards/1/source.ref allows only map and empty; …Connection settings and every go in sources.<name>.
/cards/1/source.every must be at least 1mSources refresh at most once a minute.
/cards/1/actions need a source on the same cardA button acts on the card's source, so the card needs one.
/cards/1/actions must list up to 6 buttons, or 16 in the cornerAt most six buttons on a card, or sixteen in its corner. A `"
`/cards/1/actions/2: "" goes between two buttons`
/cards/1/actions/0: add-event needs a calendar sourceAdd Event works only on a card with a calendar source.
/cards/1/actions/0: complete-reminder is only for a checklist's itemActionUse it as the checklist's itemAction.
/cards/1/itemAction is only for checklist cardsMove it to a checklist.
/cards/1/itemAction needs map.items to be an each rule, …Map the checklist's rows from the answer, so each row has fields to fill.

Other source messages follow the same pattern and name the field to fix. Source fields describes each field.

After a source answers

These aren't mistakes in the file, but they show on the card:

  • Waiting for <host>… until the source's first answer arrives.
  • Why a fetch failed, such as No secret named pihole for 192.168.1.2 in Settings → Secrets or 192.168.1.2 didn't answer in time. Before the first answer it replaces the card; after that the card keeps its last values with the message as a note under it.
  • <host>'s answer didn't fill every field this stat card needs. The map points at fields the answer doesn't have. Preview Source… in the page's right-click menu shows the answer and what each card gets from it.

Polling and failures covers fetch failures and retries.