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"
      }
    ]
  }
}
MemberMeaning
typeurn:opencanvas:problem:<code in lower case, hyphens>. A stable name, not a URL to fetch.
titleThe HTTP reason phrase of status.
statusThe HTTP status, repeated in the body.
detailWhat went wrong, in words, for logs and people. It can change between releases; do not parse it.
codeThe machine code: branch on this. The same codes the 0.1 routes use.
freshOnly 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

StatusWhat to do
400Fix the request; detail says what is wrong. Do not retry it unchanged.
401Fix the credentials: the host key, or mint a new token.
403The scope or the user's role does not allow it. Do not retry.
404Unknown file part or operation, or the API is off (API_OFF).
409CONFIRMATION_REQUIRED: send again with "confirm": true. IDEMPOTENCY_IN_PROGRESS: retry after Retry-After. CONFLICT: your save callback reported a conflict.
410CURSOR_EXPIRED: start the walk again without a cursor.
412STALE_BLOCK: re-read (or use fresh), apply your change again, send it with the new revision.
413The body or the resulting document is too large.
422IDEMPOTENCY_KEY_REUSED: a new request needs a new key.
429Wait Retry-After seconds, then retry.
5xx503 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.

CodeStatusMeaning
TOKEN_EXPIRED401The bearer token's exp has passed. Mint a new one; tokens live at most 15 minutes.
TOKEN_INVALID401A 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.
UNAUTHENTICATED401No credentials, an unknown host, or a wrong host key. The answer carries WWW-Authenticate: Bearer realm="opencanvas".
FILES_REQUIRED403The 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_FORBIDDEN403The 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_REQUIRED403The 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_OFF404The host has turned the API off ([host.flags] api_v1 = false in its entry of the hosts file).
RATE_LIMITED429A 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.
INTERNAL500An unexpected server error, or the host's POST /access callback failed. The server logs the cause; retrying may help.
BUSY503The 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).
UNAVAILABLE503A 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.

CodeStatusMeaning
BAD_INPUT400The 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_INVALID400The 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_INVALID400The 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_INVALID400The 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_INVALID400Convert: the body is not a readable .ocanvas file.
convert, legacyConvert
ROLE_INVALID400role is not view, comment, edit or none.
setRole, legacySetRole
RULE_INVALID400The rule does not parse, names an action the host does not allow, or schedules more often than the minimum.
saveAutomation
RULE_LIMIT400The canvas has max_rules rules; delete one to add another.
saveAutomation
URL_NOT_ALLOWED400A URL call to an origin that is neither the host's callback origin nor in [host.automation] allow_origins (ADR-068).
saveAutomation
USER_TOKEN_REQUIRED400Search runs as a person, so the host's permissions apply; a host key has no person.
search, listBacklinks, getGraph
EXPORT_OFF403The host's export settings do not allow this format.
exportFile
HOST_KEY_REQUIRED403Index 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_OFF403The format is not in the host's [host.flags] import_formats, or the operator set OC_IMPORT=off.
importFile, legacyImport
LIVE_DEPTH403The 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_REQUIRED403Installing, 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_CEILING403The plugin asks for a permission above the operator's or the host's ceiling. who says which.
installPlugin, requestPlugin, updatePlugin
PLUGIN_SERVER_OFF403The 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_OFF403The registry (or uploads) is switched off by the host's policy or the operator.
installPlugin, uploadPlugin
AUTOMATION_OFF404The operator has not turned automation on for this host.
listAutomations, testAutomation, listAutomationRuns, saveAutomation, deleteAutomation, enableAutomation
BLOCK_NOT_FOUND404No 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_FOUND404The canvas has no database with that dbId.
getDatabase
FORMAT_UNSUPPORTED404, 400Export (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_OFF404Backlinks and the link index need [host.flags] links = true and a database (not Redis-only storage).
listBacklinks, deleteFileLinks, indexLinks, getGraph
LIVE_OFF404Live block operations need [host.flags] live_blocks = true in the host's entry of the hosts file.
makeLive
NOT_FOUND404An unknown database, board or comment thread id, or a path that is no API operation.
getDatabase, queryRows, upsertRows, addField, createBoard, readBoard, addShapes, addComment
PLUGINS_OFF404The 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_FOUND404No such registry, plugin, version, install or request for this host.
getPluginDetails, installPlugin, requestPlugin, declinePluginRequest, closePluginRequest, patchPlugin, removePlugin, updatePlugin, rollbackPlugin
RULE_NOT_FOUND404No rule with that id in this canvas.
deleteAutomation, enableAutomation
SEARCH_UNAVAILABLE404The host has not turned on [host.search] callback, or its GET /search answered 404, 405 or 501.
search
CONFIRMATION_REQUIRED409The batch deletes more than 5 blocks. Send it again with "confirm": true.
batchBlocks
CONFLICT409Your 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_PROGRESS409A 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_REQUIRED409accept 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_ROLLBACK409Roll back needs the version before the last update, still on this server.
rollbackPlugin
CURSOR_EXPIRED410Cursors last an hour. Start the walk again without one.
listBlocks, queryRows
FILE_GONE410Your POST /access answered 410 (or gone) for the canvas asked about.
listBacklinks, getGraph
STALE_BLOCK412A 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_LARGE413The 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_LARGE413The change would make the canvas larger than the server's document limit.
importFile, legacyPatch, legacyImport
IMPORT_TOO_LARGE413The file is over 5 MiB, or a CSV has more than 10,000 rows or 200 columns.
importFile, legacyImport
EXTRACT_TOO_SLOW422Extraction has a 2 s budget per file.
extract
IDEMPOTENCY_KEY_REUSED422The 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_OCANVAS422The extract body is not a readable .ocanvas (or not UTF-8 Markdown).
extract
PLUGIN_BAD_SIGNATURE422A signature does not verify.
installPlugin, uploadPlugin, updatePlugin, rollbackPlugin
PLUGIN_INCOMPATIBLE422, 403engines.opencanvas does not include this server's version.
installPlugin, uploadPlugin, requestPlugin, updatePlugin, rollbackPlugin
PLUGIN_INVALID422The package is not a well-formed .ocplugin: zip, manifest, paths, sizes, icon or screenshots.
installPlugin, uploadPlugin, updatePlugin, rollbackPlugin
PLUGIN_NOT_IN_INDEX422The package is signed but not listed in the registry's current index (for uploads: in no configured registry).
installPlugin, uploadPlugin, updatePlugin, rollbackPlugin
PLUGIN_REVOKED422, 403The 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_TAMPERED422A 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_KEY422Signed by a key that is not registered for the publisher (or is not the marketplace's).
installPlugin, uploadPlugin, updatePlugin, rollbackPlugin
PLUGIN_UNSIGNED422, 403A 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_STREAMS429A server holds at most 100 event streams per file. Close one, or share one stream between your workers.
streamEvents
LIVE_CREATE_UNSUPPORTED501Your POST {callback_base}/files answered 404, 405 or 501: "Make live" needs it.
makeLive
PDF_RENDERER_NOT_CONFIGURED501PDF needs the operator to run the Gotenberg sidecar and set OC_PDF_RENDERER.
exportFile, convert, legacyConvert
HOST_ERROR502The host's search callback failed or answered something that is not a search answer.
search
HOST_UNAVAILABLE502Your 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_EXPIRED503The registry's signed index is past its expires (it is refreshed at least weekly); installed plugins keep running.
installPlugin, updatePlugin
PLUGIN_REGISTRY_UNAVAILABLE503, 422The registry's signed index has not been fetched yet, or the package could not be downloaded.
installPlugin, updatePlugin
ROOM_UNAVAILABLE503The change could not be stored in the live room. Retry.
importFile, legacyPatch, legacyImport
HOST_TIMEOUT504The 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.

CodeStatusMeaning
UNAUTHORIZED401A fallback for a 401 that did not carry its own code.
FORBIDDEN403A fallback for a 403 that did not carry its own code.
METHOD_NOT_ALLOWED405The path exists but not with this method; Allow lists the methods it takes.
UNSUPPORTED_MEDIA_TYPE415A fallback for a request the router could not read.
ERRORotherAny 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.

CodeStatusMeaning
PATCH_INVALID4000.1 patch: an op is malformed.
API_KEY_INVALID4010.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 .