Errors
Every error answer is RFC 9457 problem details, application/problem+json, with a machine code you can branch on. The code is stable; the human detail is not.
The shape
{
"type": "urn:opencanvas:problem:stale-block",
"title": "Precondition Failed",
"status": 412,
"detail": "a block changed since it was read; re-read it and retry",
"code": "STALE_BLOCK",
"fresh": {
"stale": [
{
"blockId": "b_01m87jv4rtkdxymn93jwtx35sk",
"rev": "5641be1fd2cb",
"markdown": "Ship on Friday.\n"
}
]
}
}
| Member | Meaning |
|---|---|
type | urn:opencanvas:problem:<code in lower case, hyphens>. A stable name, not a URL to fetch. |
title | The HTTP reason phrase of status. |
status | The HTTP status, repeated in the body. |
detail | What went wrong, in words, for logs and people. It can change between releases; do not parse it. |
code | The machine code: branch on this. The same codes the 0.1 routes use. |
fresh | Only with STALE_BLOCK: the current state to retry against. |
Unknown members may be added later; ignore them. Even answers the router gives before an operation runs (an unknown path, a wrong method) are problem details, so a client parses one error format.
Handling them
| Status | What to do |
|---|---|
400 | Fix the request; detail says what is wrong. Do not retry it unchanged. |
401 | Fix the credentials: the host key, or mint a new token. |
403 | The scope or the user's role does not allow it. Do not retry. |
404 | Unknown file part or operation, or the API is off (API_OFF). |
409 | CONFIRMATION_REQUIRED: send again with "confirm": true. IDEMPOTENCY_IN_PROGRESS: retry after Retry-After. CONFLICT: your save callback reported a conflict. |
410 | CURSOR_EXPIRED: start the walk again without a cursor. |
412 | STALE_BLOCK: re-read (or use fresh), apply your change again, send it with the new revision. |
413 | The body or the resulting document is too large. |
422 | IDEMPOTENCY_KEY_REUSED: a new request needs a new key. |
429 | Wait Retry-After seconds, then retry. |
5xx | 503 and 502 are transient: retry after Retry-After with backoff. 501: the server is not set up for it (PDF). |
The TypeScript and Rust clients turn these into typed errors and retry 429, 503 and 409 IDEMPOTENCY_IN_PROGRESS for you; see SDKs.
Every code
Any operation on a file
Authentication, the API switch, rate limits and availability: every /api/v1 operation on a file can answer these.
| Code | Status | Meaning |
|---|---|---|
TOKEN_EXPIRED | 401 | The bearer token's exp has passed. Mint a new one; tokens live at most 15 minutes. |
TOKEN_INVALID | 401 | A bearer token failed a check: signature, issuer, audience, a lifetime over 15 minutes, or not yet valid (nbf). Also answered when the host has no public base URL, so user tokens are off for it. |
UNAUTHENTICATED | 401 | No credentials, an unknown host, or a wrong host key. The answer carries WWW-Authenticate: Bearer realm="opencanvas". |
FILES_REQUIRED | 403 | The host does not implement POST /access, so a token's role claim counts only for the files in its files claim, and this token has none. Add files, implement /access, or set [host.api] all_files = true. |
ROLE_FORBIDDEN | 403 | The user's role on the file is below what the operation needs (the effective permission is min(scope, role)), the token does not list the file in files, or the host revoked the user. |
SCOPE_REQUIRED | 403 | The token's scope does not cover the operation. Admin operations need canvas:admin, which counts only when the host sets [host.api] token_admin = true. |
API_OFF | 404 | The host has turned the API off ([host.flags] api_v1 = false in its entry of the hosts file). |
RATE_LIMITED | 429 | A token bucket is empty: the caller's, or the file's write bucket. Wait for Retry-After seconds. The RateLimit header says which bucket and when it refills. |
INTERNAL | 500 | An unexpected server error, or the host's POST /access callback failed. The server logs the cause; retrying may help. |
BUSY | 503 | The server cannot take the request right now: rooms are recovering after a restart, or no database connection is free. The answer carries Retry-After (1-5 s); send the same request again after it. Never a 500 for overload (RLB-01b). |
UNAVAILABLE | 503 | A dependency is briefly unavailable: the idempotency store, the node that runs the file's live room, or the ticket store. Retry after Retry-After. |
Operation-specific
Each operation's section in the reference lists the ones it can answer.
| Code | Status | Meaning |
|---|---|---|
BAD_INPUT | 400 | The request is not what the operation takes: the body is not a JSON object, a field is missing or has the wrong type, an op, mode, format or event type is unknown, or fileId is longer than 1,024 bytes. detail says which.readFile, findBlocks, batchBlocks, createDatabase, queryRows, upsertRows, addField, createBoard, addShapes, addComment, makeLive, setRole, streamEvents, search, offlineRevoke, testAutomation, saveAutomation, deleteAutomation, enableAutomation, listBacklinks, deleteFileLinks, indexLinks, getGraph, installPlugin, putPluginPolicy, requestPlugin, declinePluginRequest, patchPlugin, updatePlugin |
CURSOR_INVALID | 400 | The cursor is not one this server signed for this file and query: changed, truncated, from another host, or sent with a different filter, sort or fields. Pass next_cursor back unchanged.listBlocks, queryRows |
IDEMPOTENCY_KEY_INVALID | 400 | The Idempotency-Key header is empty, longer than 255 bytes, or has characters outside visible ASCII.batchBlocks, createDatabase, upsertRows, addField, createBoard, addShapes, addComment, makeLive, importFile, commitFile, setRole, invalidateMembers, testAutomation, saveAutomation, deleteAutomation, enableAutomation |
IMPORT_INVALID | 400 | The file could not be read: not UTF-8, a malformed CSV, or a diagram that is unreadable, too deep or declares entities.importFile, legacyImport |
INPUT_INVALID | 400 | Convert: the body is not a readable .ocanvas file.convert, legacyConvert |
ROLE_INVALID | 400 | role is not view, comment, edit or none.setRole, legacySetRole |
RULE_INVALID | 400 | The rule does not parse, names an action the host does not allow, or schedules more often than the minimum.saveAutomation |
RULE_LIMIT | 400 | The canvas has max_rules rules; delete one to add another.saveAutomation |
URL_NOT_ALLOWED | 400 | A URL call to an origin that is neither the host's callback origin nor in [host.automation] allow_origins (ADR-068).saveAutomation |
USER_TOKEN_REQUIRED | 400 | Search runs as a person, so the host's permissions apply; a host key has no person.search, listBacklinks, getGraph |
EXPORT_OFF | 403 | The host's export settings do not allow this format.exportFile |
HOST_KEY_REQUIRED | 403 | Index maintenance (DELETE /api/v1/links/files/{fileId}, POST /api/v1/links/index) is for your application, with the host key; a person's token is refused.deleteFileLinks, indexLinks, getPlugins, listPluginCatalog, getPluginDetails, installPlugin, uploadPlugin, refreshPlugins, getPluginPolicy, putPluginPolicy, listPluginRequests, requestPlugin, declinePluginRequest, closePluginRequest, patchPlugin, removePlugin, updatePlugin, rollbackPlugin |
IMPORT_OFF | 403 | The format is not in the host's [host.flags] import_formats, or the operator set OC_IMPORT=off.importFile, legacyImport |
LIVE_DEPTH | 403 | The canvas is itself a live file (meta.kind = "live"), which may not contain live blocks or references (the depth rule, docs/27 §2.2).makeLive |
PLUGIN_ADMIN_REQUIRED | 403 | Installing, updating, removing, the policy and answering requests are for plugin admins: the host key, or a launch token with perms.plugins: "admin". People may request (unless the policy is "Only admins"), or install plugins on the allowed list in "anyone" mode.installPlugin, uploadPlugin, refreshPlugins, putPluginPolicy, requestPlugin, declinePluginRequest, closePluginRequest, patchPlugin, removePlugin, updatePlugin, rollbackPlugin |
PLUGIN_CEILING | 403 | The plugin asks for a permission above the operator's or the host's ceiling. who says which.installPlugin, requestPlugin, updatePlugin |
PLUGIN_SERVER_OFF | 403 | The plugin has server parts, and the operator ([plugins] server_code) or the host's policy does not allow them. who says which.installPlugin, requestPlugin, updatePlugin |
PLUGIN_SOURCE_OFF | 403 | The registry (or uploads) is switched off by the host's policy or the operator.installPlugin, uploadPlugin |
AUTOMATION_OFF | 404 | The operator has not turned automation on for this host.listAutomations, testAutomation, listAutomationRuns, saveAutomation, deleteAutomation, enableAutomation |
BLOCK_NOT_FOUND | 404 | No block in the canvas has that blockId (the path's, an op's blockId, or a comment's blockId).getBlock, batchBlocks, createDatabase, addComment, makeLive, importFile, legacyPatch, legacyImport |
DB_NOT_FOUND | 404 | The canvas has no database with that dbId.getDatabase |
FORMAT_UNSUPPORTED | 404, 400 | Export (404): the format in the path is not one of md, html, json, ocanvas, docx, pdf. Convert (400): from or to is not supported.exportFile, renderFile, convert, legacyConvert |
LINKS_OFF | 404 | Backlinks and the link index need [host.flags] links = true and a database (not Redis-only storage).listBacklinks, deleteFileLinks, indexLinks, getGraph |
LIVE_OFF | 404 | Live block operations need [host.flags] live_blocks = true in the host's entry of the hosts file.makeLive |
NOT_FOUND | 404 | An unknown database, board or comment thread id, or a path that is no API operation.getDatabase, queryRows, upsertRows, addField, createBoard, readBoard, addShapes, addComment |
PLUGINS_OFF | 404 | The operator has no [plugins] configuration, or the host has not set [host.flags] plugins = true.getPlugins, listPluginCatalog, getPluginDetails, installPlugin, uploadPlugin, refreshPlugins, getPluginPolicy, putPluginPolicy, listPluginRequests, requestPlugin, declinePluginRequest, closePluginRequest, patchPlugin, removePlugin, updatePlugin, rollbackPlugin |
PLUGIN_NOT_FOUND | 404 | No such registry, plugin, version, install or request for this host.getPluginDetails, installPlugin, requestPlugin, declinePluginRequest, closePluginRequest, patchPlugin, removePlugin, updatePlugin, rollbackPlugin |
RULE_NOT_FOUND | 404 | No rule with that id in this canvas.deleteAutomation, enableAutomation |
SEARCH_UNAVAILABLE | 404 | The host has not turned on [host.search] callback, or its GET /search answered 404, 405 or 501.search |
CONFIRMATION_REQUIRED | 409 | The batch deletes more than 5 blocks. Send it again with "confirm": true.batchBlocks |
CONFLICT | 409 | Your save callback answered that the file changed outside OpenCanvas; the host's conflict policy runs and the save is not retried.importFile, commitFile, legacyPatch, legacyCommit, legacyImport |
IDEMPOTENCY_IN_PROGRESS | 409 | A request with the same key is still running, on this or another node. Retry after Retry-After (1 second) to get its answer.batchBlocks, createDatabase, upsertRows, addField, createBoard, addShapes, addComment, makeLive, importFile, commitFile, setRole, invalidateMembers, testAutomation, saveAutomation, deleteAutomation, enableAutomation |
PLUGIN_CONSENT_REQUIRED | 409 | accept must list every permission the package asks for (flat names such as canvas.write, network:https://…). The answer's permissions is the full list to show and accept.installPlugin, updatePlugin |
PLUGIN_NO_ROLLBACK | 409 | Roll back needs the version before the last update, still on this server.rollbackPlugin |
CURSOR_EXPIRED | 410 | Cursors last an hour. Start the walk again without one.listBlocks, queryRows |
FILE_GONE | 410 | Your POST /access answered 410 (or gone) for the canvas asked about.listBacklinks, getGraph |
STALE_BLOCK | 412 | A block op's ifMatch or the If-Match header names a revision that is no longer current. fresh carries the current state: the changed blocks with their rev and Markdown, or the document rev. Nothing was applied.batchBlocks |
BODY_TOO_LARGE | 413 | The request body is over the server's limit (at least 5 MiB, the import limit).batchBlocks, createDatabase, upsertRows, addField, createBoard, addShapes, addComment, importFile, commitFile, setRole, invalidateMembers, convert, extract, offlineRevoke, testAutomation, saveAutomation, enableAutomation |
DOC_TOO_LARGE | 413 | The change would make the canvas larger than the server's document limit.importFile, legacyPatch, legacyImport |
IMPORT_TOO_LARGE | 413 | The file is over 5 MiB, or a CSV has more than 10,000 rows or 200 columns.importFile, legacyImport |
EXTRACT_TOO_SLOW | 422 | Extraction has a 2 s budget per file.extract |
IDEMPOTENCY_KEY_REUSED | 422 | The key was used in the last 24 hours with another method, path or body. Use a new key for a new request.batchBlocks, createDatabase, upsertRows, addField, createBoard, addShapes, addComment, makeLive, importFile, commitFile, setRole, invalidateMembers, testAutomation, saveAutomation, deleteAutomation, enableAutomation |
NOT_OCANVAS | 422 | The extract body is not a readable .ocanvas (or not UTF-8 Markdown).extract |
PLUGIN_BAD_SIGNATURE | 422 | A signature does not verify.installPlugin, uploadPlugin, updatePlugin, rollbackPlugin |
PLUGIN_INCOMPATIBLE | 422, 403 | engines.opencanvas does not include this server's version.installPlugin, uploadPlugin, requestPlugin, updatePlugin, rollbackPlugin |
PLUGIN_INVALID | 422 | The package is not a well-formed .ocplugin: zip, manifest, paths, sizes, icon or screenshots.installPlugin, uploadPlugin, updatePlugin, rollbackPlugin |
PLUGIN_NOT_IN_INDEX | 422 | The package is signed but not listed in the registry's current index (for uploads: in no configured registry).installPlugin, uploadPlugin, updatePlugin, rollbackPlugin |
PLUGIN_REVOKED | 422, 403 | The version, the plugin or its publisher is revoked in the signed index; it cannot be installed, pinned or rolled back to.installPlugin, uploadPlugin, requestPlugin, updatePlugin, rollbackPlugin |
PLUGIN_TAMPERED | 422 | A file differs from the hash in the manifest, a file is not named in it or is missing, or the package differs from the version in the index.installPlugin, uploadPlugin, updatePlugin, rollbackPlugin |
PLUGIN_UNKNOWN_KEY | 422 | Signed by a key that is not registered for the publisher (or is not the marketplace's).installPlugin, uploadPlugin, updatePlugin, rollbackPlugin |
PLUGIN_UNSIGNED | 422, 403 | A required signature is missing. Unsigned packages come only from a private registry the operator names with allow_unsigned.installPlugin, uploadPlugin, requestPlugin, updatePlugin, rollbackPlugin |
TOO_MANY_STREAMS | 429 | A server holds at most 100 event streams per file. Close one, or share one stream between your workers.streamEvents |
LIVE_CREATE_UNSUPPORTED | 501 | Your POST {callback_base}/files answered 404, 405 or 501: "Make live" needs it.makeLive |
PDF_RENDERER_NOT_CONFIGURED | 501 | PDF needs the operator to run the Gotenberg sidecar and set OC_PDF_RENDERER.exportFile, convert, legacyConvert |
HOST_ERROR | 502 | The host's search callback failed or answered something that is not a search answer.search |
HOST_UNAVAILABLE | 502 | Your load or save callback failed or timed out, so the file could not be loaded or saved.readFile, batchBlocks, createDatabase, upsertRows, addField, createBoard, addShapes, addComment, exportFile, renderFile, makeLive, importFile, legacyPatch, legacyImport, listAutomations, testAutomation, listAutomationRuns, saveAutomation, deleteAutomation, enableAutomation |
INDEX_EXPIRED | 503 | The registry's signed index is past its expires (it is refreshed at least weekly); installed plugins keep running.installPlugin, updatePlugin |
PLUGIN_REGISTRY_UNAVAILABLE | 503, 422 | The registry's signed index has not been fetched yet, or the package could not be downloaded.installPlugin, updatePlugin |
ROOM_UNAVAILABLE | 503 | The change could not be stored in the live room. Retry.importFile, legacyPatch, legacyImport |
HOST_TIMEOUT | 504 | The host's search callback took longer than [host.search] timeout_ms (default 8 s).search |
Router fallbacks
Answers the router gives before an operation runs.
| Code | Status | Meaning |
|---|---|---|
UNAUTHORIZED | 401 | A fallback for a 401 that did not carry its own code. |
FORBIDDEN | 403 | A fallback for a 403 that did not carry its own code. |
METHOD_NOT_ALLOWED | 405 | The path exists but not with this method; Allow lists the methods it takes. |
UNSUPPORTED_MEDIA_TYPE | 415 | A fallback for a request the router could not read. |
ERROR | other | Any other error status without its own code. |
0.1 routes only
The deprecated /v1/... routes answer {"error": {"code", "message"}} with these and the codes above.
| Code | Status | Meaning |
|---|---|---|
PATCH_INVALID | 400 | 0.1 patch: an op is malformed. |
API_KEY_INVALID | 401 | 0.1 routes: the host id or key is missing or wrong. |
The 0.1 routes
The deprecated /v1/files/{fileId}/... routes keep their old error shape, {"error": {"code": "...", "message": "..."}}, with the same codes. Only /api/v1 answers problem details.
Last changed .