Skip to content

hosaka.fm

Errors, limits and replays

A failed tool call is not a transport error: the result is a normal envelope with ok: false, isError: true on the MCP result, and an error object:

{ "type": "rate_limited", "message": "Too many requests this minute for this account.", "recoverable": true, "retryable": true, "data": { "fix_hint": "Pace calls to under the per-minute allowance.", "retry_after_ms": 2000 } }

error.type vocabulary

The vocabulary is closed. Since Sprint 14 (Task 14.2) the tool descriptions no longer enumerate it: the full list with its retryability is in the server's initialize instructions and in the hosaka://guide resource (once per session, not once per tool; the descriptions keep a one-line rules reminder and name the key forms they accept), and hosaka://capabilities publishes it with a retryable flag per code. "varies" means the value depends on the situation and the row explains how.

error.typerecoverableretryableWhat it means and what to do
invalid_argumentyesnoan argument failed validation; data.param names it, data.fix_hint says how to fix it. Fix and call again. get_artist answers it for an unknown facets name before any upstream call; fix_hint lists the published facet names (and all)
one_of_requiredyesnothe tool needs one of several alternative arguments and got none (for example resolve_artist without q, url, cluster_id, discogs_id or mbid)
range_too_largeyesnolimit or a range exceeds the tool's maximum; data names the maximum. Lower it. get_artist facets takes at most 12 names per call (or ["all"], which pages by itself)
placeholder_detectedyesnoan argument looks like a placeholder (<cluster_id>, TODO, string). Resolve the real value first
unauthorizedvariesnono or invalid token on a signed-in tool — recoverable: start the sign-in from _meta["mcp/www_authenticate"]. Not recoverable when the signed-in account is inactive
insufficient_scopereservedreservednot issued today; every signed-in tool uses the same scopes
quota_exceedednonothe account's allowance for the period is used up; data.reset_at (UTC) says when it resets, data.used/data.allowance the figures. Relay that; nothing is purchased inside the assistant
anonymous_capacity_exhaustedyesyesanonymous capacity is used up or paused; sign in for a personal allowance, or retry later
rate_limitedyesyestoo many calls per minute, too many concurrent calls, or too many anonymous calls from one caller; slow down, honour retry_after_ms. With data.cause: "deck_admission": find_tracks batch resolution is paced across all accounts (the data service allows 60 batch calls a minute in total); nothing was sent, no unit was spent — wait retry_after_ms. With data.cause: "family_inflight" (Sprint 13 Task 13.2) this server has too many calls of one request family in flight (data.reason: family_limit — the server's ceiling for the family — or subject_share — this caller already holds its share of the slots); nothing was sent; wait retry_after_ms (1 s).
linked_capacity_exhaustedyesyeshosaka's shared capacity for signed-in accounts is exhausted for now; retry in a few minutes
request_in_progressyesyesthe identical request is already running (a concurrent duplicate); retry after data.retry_after_ms
upstream_degradedyesyesthe data service is in a degraded window (see below); retry after 30 s or follow next_actions
upstream_errorvariesvariesthe data service answered with an error or a deadline passed. Retryable on a 5xx, an upstream rate limit or a deadline (data.cause); not retryable on a record that is not available. Not recoverable if the service refused hosaka's credentials — report it
metering_unavailableyesyeshosaka could not meter the call so it was not served (fail-closed); retry shortly
tool_disabledyesvariesthe tool is switched off by hosaka for now; data.reason is a short code and data.fix_hint says whether to retry later or sign in
idempotency_conflictreservedreservednot issued today
internalnonoan unexpected server error; report meta.request_id

Cursors (search_catalog)

A cursor is opaque, bound to the signed-in account and to the exact q + filters, and checked before any upstream call. Three things produce invalid_argument with data.param: "cursor": a value this server did not issue (edited, truncated, invented), a cursor replayed from another account, or a cursor carried to a different query. A fourth comes from the data service itself when it no longer accepts a cursor this server did issue (expired). The fix is always the one in data.fix_hint: omit cursor and start the same search again. Since Sprint 12 a cursor also carries the kind of walk that issued it (search, browse or surface) and an authenticated expiry of about an hour: a cursor handed to a different tool, an edited expiry or an expired cursor is the same invalid_argument with the same hint. Unsigned v1 offset cursors (and the kind-less Sprint 10 form) are accepted until 2026-11-30T00:00Z and then answer invalid_argument ("cursor format retired"): omit cursor to restart. A cursor longer than 2048 characters fails input validation. Since Sprint 16 every cursor that carries a key or a URL is sealed (3.*: encrypted and authenticated; it carries no readable row content); offset-only cursors (browse_artists, the read_surface listing) stay tagged, and a read_surface walk whose upstream cursor cannot be carried ends the same visible way (walk_ended_early, also printed in the text block) Cursors are never issued to anonymous callers (search_catalog requires a signed-in account). A walk can also end early when the data service hands back a cursor this server cannot carry: next_cursor is null and pagination.walk_ended_early explains it (more rows may exist; a narrower query is a new walk).

Deadlines and data.cause

Each upstream call and the tool as a whole run against deadlines. When one passes the error is upstream_error with data.cause:

data.causeMeaning
call_deadlineone upstream call exceeded its per-call deadline (typically a cold dossier); the tool answered honestly instead of waiting
tool_deadlinethe whole tool exceeded its deadline (data.deadline_ms)
client_abortthe client cancelled the request
upstream_oversizedthe data service answered with a body over the deck's 1 MiB ceiling (refused by Content-Length before any byte is read, or cut by a byte-counted stream); not retried — narrow the request (a smaller view, fewer facets, a smaller limit)

A deadline-failed call is still metered (meta.units counts the upstream calls made). Retrying a call_deadline after a few seconds often succeeds because the upstream cache is then warm.

Per-family budgets (Sprint 13 Task 13.2, measured 2026-10-20). The per-call timer is per request FAMILY, under the unchanged 12 s tool deadline. hosaka://capabilities publishes them as limits.upstream_call_timeout_ms {default, families}:

family (tools)per-call budgetwhy
artist (get_artist), label (get_label), surface (read_surface rows), tracksResolve (find_tracks batch)11 s = min(11 000, max(the 8 s default, tool deadline − 1 000)), derived — a budget extends the default, never shortens itthe live probe measured dense surface rows at 8.1 s cold (then 50–80 ms warm) and large-catalogue dossiers at 13–24 s cold / 5–13 s warm — the first fits 11 s, the second does not fit even warm, so a cold card of a very large catalogue is still an honest call_deadline until the data service ships its precomputed dossier
search (search_catalog, the same-name probe of resolve_artist) — Sprint 1510.5 s = min(10 500, max(the 8 s default, tool deadline − 1 500)), derived — 1 500 ms of tool slackthe capacity model of 2026-10-22: under a burst the share of searches past the budget falls from 16.0 % at 8 s to 9.9 % at 10.5 s (modelled; the 8–10 s completions become answers); the data service's own query_timeout arrives later than 10.5 s at the median, so a slow search still ends as call_deadline
every other family8 s (CRATE_CALL_TIMEOUT_MS)measured well inside it

Search under a burst (Sprint 15). search also has an in-flight ceiling of 12 per server task (limits.family_inflight_max.search; the same per-caller share of 4) — the 13th concurrent search on one task is refused before anything is sent as rate_limited with data.cause: "family_inflight" and retry_after_ms: 1000 (no unit). Each search holds its slot a little longer at 10.5 s, so a sustained burst reaches the ceiling sooner than before. A search call_deadline is never retried and counts only in the search family's ring: under a burst the search ring opens and fails fast for 30 s — the designed answer (upstream_degraded with degraded.recommended_action: "retry_after_30s" while it is open — counted apart from the ceiling; other families and the rest of the server are unaffected). Retry after the 30 s, or narrow the query.

Two controls ship with the longer budgets: a per-family in-flight ceiling per server task (12 for the budgeted families and, since Sprint 15, search, of which one identified caller — a linked account or an anonymous actor — holds at most 4; the shared ChatGPT egress bucket is bounded by the ceiling alone — limits.family_inflight_max, limits.family_inflight_subject_share) — above it the call is refused before anything is sent as rate_limited with data.cause: "family_inflight" and retry_after_ms: 1000 (no unit) — and a remaining-time floor for optional fan-out: when the tool has less than 1 500 ms left after the primary call (limits.include_remaining_floor_ms), a get_artist include is not sent and reads {present: false, reason: "deadline_budget_exhausted"} with the dedicated tool in next_actions (no unit for the call not made). An include refused by the server's own in-flight ceiling reads {present: false, reason: "upstream_degraded"} with the dedicated tool in next_actions (the card is still served; nothing was sent). An include that IS sent runs on its own share of the remaining deadline (the remaining time minus limits.include_deadline_margin_ms, 600 ms): if it runs out, the card is still served and the include reads the same deadline_budget_exhausted gap (that call was made, so it is counted) — a slow include never costs the card.

Default-card headroom (Sprint 13 Task 13.4, measured 2026-10-20). Every tool's default-argument card fits the 1 500 soft target on the fixture corpus; the live-sized get_label and get_artist standard cards keep ≥ 100 tokens of headroom (≤ 1 400). A LIST card (search_catalog, browse_artists, read_surface rows, list_tastemakers) is sized by its text rows: the renderer prints as many numbered row lines as fit under the soft target and prints fewer when the rows are long, which is what absorbs live prose variance on those cards. The search_catalog card alone has a search-only target of 1 450: its rows stop 50 tokens under the soft target, so the live-sized search_catalog limit 10 card no longer sits on the 1 500 edge (it measured 1 487–1 500 before — freed structured tokens only let more rows print; other list cards keep filling to the target so their id lines survive). The default search row no longer carries cube_quadrant (a nullable string no agent doc, skill or test used — the cube page each row links to shows it) and the row-1 why is shorter — both buy printed row lines for text-only hosts under the same target; the per-row 64-hex ids are intact. Measured cost of the 1 450 target (2026-10-20, live-sized set): with the headroom the text block prints 6, 8 and 10 of 10 row lines on the three pages where the 1 500 target printed 10 of 10 — a text-only host sees fewer rows in exchange for the headroom; structuredContent carries every row either way. Decided 2026-10-21 (AC-13.6): the search card returns to the ladder's 1 500 — since Sprint 15 TEXT_ROWS_HEADROOM_TOKENS is 1 500 for every list card (envelope.md, "Rows and the cursor"); 1450 is the documented rollback. The label card serves the first 3 related labels and names the cut in meta.trimmed ({path: "data.travels.related", kept: 3, total}); related rows beyond the third are not served by any tool today.

The deck does not retry on your behalf yet: the per-family budgets landed in Sprint 13 (above); the pre-fetch of the artist card at resolve time and the single retry-on-warm for the artist family (Sprint 14 Task 14.3) follow them, so a call_deadline on get_artist is answered honestly at the first timer. crate has told hosaka (fyi 2026-10-19) that the full dossier of a large catalogue exceeds its 8 s edge budget structurally, on quiet days too, until it ships a precomputed dossier: expect call_deadline on get_artist for the biggest catalogues (view: full first) and retry once after a few seconds rather than looping.

The degraded window (upstream_degraded)

If the data service fails repeatedly, hosaka stops calling it for 30 s and answers upstream_degraded immediately, with degraded.recommended_action: "retry_after_30s". Since Sprint 9 the window is also kept per data family: repeated deadlines on one family (for example artist dossiers) open the window for that family only, so resolve_artist keeps working while get_artist is degraded, and a get_artist include whose family is degraded comes back as present: false, reason: "upstream_degraded" with a next_actions entry rather than failing the whole card. Since Sprint 10 a family window also needs several distinct callers: one caller's deadlines can contribute only a minority of the window, so a single client cannot degrade a family for everyone else — if you alone see repeated deadlines, slow your own calls rather than expecting the window to open.

A 404 from the data service for a key you passed is not an error: find_similar_artists, get_upcoming_gigs, get_label and the aura lookup answer ok: true with present: false and reason: "not_found_upstream" plus a next_actions entry (resolve the name again); meta.units is charged as usual.

Key forms (Sprint 14 Task 14.2, review cycle 1)

key on get_artist, find_similar_artists, get_upcoming_gigs and get_release is a 64-hex cluster_id or crate's slug ([a-z0-9-], the data.slug of resolve_artist) — nothing else. Both forms are passed straight to crate, whose artist, similar and gigs routes accept either natively (crate OpenAPI 2.62.0: "{key} = 64-hex cluster_id (canonical) or a name slug"), so the same slug and the same cluster_id answer the same rows for the same units and the deck never resolves a key by name or picks an identity for a homonym (crate's slug semantics, name-2 suffixes included, stay crate's). data.key echoes the form you passed, case-folded to lowercase (crate's slug form); an all-digit string is a Discogs id, not a slug, and is refused with resolve_artist { discogs_id } suggested. A name, a URL, a placeholder or any other string is refused before any upstream call (0 units) with invalid_argument on key and suggested_tool_calls: [{ tool: "resolve_artist", args: { q | url } }] — resolve first, then pass the cluster_id. A slug hosaka does not know is an honest gap (present: false, reason: "not_found_upstream"), never a guess. The deck's tool_call log line records only the shape of the key (key_shape: hex64, slug, numeric, other, none), never its value, so invented keys are countable without any id leaving the request.

Budgets a client can see

Idempotency and replays

Identical calls (same account, same tool, same arguments, same view) made within the idempotency window are answered from the stored result with meta.replay: true and are not metered again. A duplicate that arrives while the first is still running waits briefly and then answers request_in_progress with retry_after_ms. If the replay store cannot be reached the call is still served, with meta.idempotency: "unavailable" to say that no replay protection applied. There is no client-supplied idempotency key: the server derives it from the call.

Batch track resolution (find_tracks with tracks[])

One call resolves up to 25 {title, artist?, year?} entries for one unit — the published cap limits.find_tracks_batch_max in hosaka://capabilities (Sprint 13 Task 13.3: set FROM MEASUREMENT on 2026-10-20, when every batch size from 2 to 25 titles answered in under half a second; the operator can lower or raise it with FIND_TRACKS_BATCH_MAX, 1–50, without a code change). Above the cap the tool answers range_too_large before any upstream call, naming the cap and asking for the remainder in the next call. Throughput follows from the cap and the per-account allowance: one account resolves at most 250 titles in a clock minute (25 titles × 10 batch calls). The deck admits at most 30 batch calls per clock minute across every account and every server instance of the environment (one shared counter; the data service allows 60 in total, and a fixed window never admits more than twice its size in any sliding minute), and at most 10 per account, so one account cannot take the whole allowance. A refused call answers rate_limited with data.cause: "deck_admission", data.reason (family_limit or subject_share) and retry_after_ms (the next clock minute); it sends nothing and spends no unit. Two residuals: while the shared counter is unreachable each server instance keeps its own window (the environment may then admit up to the allowance per instance), and the allowance is per environment — when two environments share one upstream key the operator splits it between them. A batch that reached the data service is never re-sent by the deck, whatever the answer (so a single failure answers upstream_error at once rather than a hidden second attempt that could bill twice); only a connection that could not be opened is retried. Titles and artist names in a batch are the caller's content: they are never written to the deck's logs and never metered beyond their count.

One live client at a time (operator runners, not MCP clients)

The deck's own live runners (scripts/golden-tokens-live.ts, scripts/submission-test-cases.ts and every other script built on scripts/lib/live-rpc.ts) and the two host-harness commands (wrapped by scripts/live-lock.sh) take one lock, .run/live-client.lock (pid, start time, script name): a second live client in the same checkout refuses to start naming the holder's pid, ALLOW_CONCURRENT_LIVE=1 overrides it, a dead holder's lock is reclaimed, and the lock is released on exit and on SIGINT (Sprint 14 Task 14.5). The file is created WITH its content in one step (a private temp file hard-linked into place — link fails when a lock exists and never exposes an empty file), so two starters cannot both hold it; a stale holder (dead pid, or an unreadable file older than a few seconds) is reclaimed by renaming it aside and re-reading it, and a holder that turns out to be live is put back and refused; the wrapper releases only a lock that still carries its own pid. It exists because concurrent probes from one machine opened the deck's artist family window against everyone else on 2026-10-19 — the family window needs several distinct callers, and a probe fleet counts as several. It is not a limit on MCP clients: rate_limited and the per-account concurrency cap above are the client-facing limits. The staging canary that measures the card's arrival reads its key list from the deck image, walks resolve_artist → get_artist → a pause → get_artist with the second read from a different synthetic account (an identical call from the same account inside the idempotency window would be a replay, not a crate read), and counts its ok-rate as ok ÷ (ok + upstream_error + deadline + http_5xx) — client errors, deck limits, degraded windows, honest not-founds and replays sit outside the denominator.

Page sizes and the unit floor

Every served signed-in call costs at least one unit, including a read_surface registry listing answered from the deck's 15-minute cache (the upstream read behind it happened on an earlier call). read_surface rows take an optional limit: omitted, the surface's default_limit (sized to the default budget) is served; up to its max_limit the page is a heavy shape that fits the hard cap. get_release for a Bandcamp item is compact by default (tracks_total); include: ["tracks"] adds the track list (up to 25 per call, a heavy shape). search_catalog with include: ["facet_counts"] and a multi-value filter (genre: [a, b]) answers facet_counts: {present: false, reason: "multi_value_filter_unsupported"} without the extra unit: counts for a different filter set would be a wrong answer.

Provenance

Vendored from ono-sendai docs/agents/errors-and-limits.md at commit ba7dba0 on 2026-11-01. ono-sendai is the source of truth; this page is regenerated from the pinned commit and a test fails if the two disagree. The other pages in this set: connect, tools, envelope, errors and limits, data posture — and the agents landing.