toeverything/AFFiNE · error · ToolError

DOC_CANVAS_READ_FAILED

DOC_CANVAS_READ_FAILED

Error message

The persisted canvas could not be read.

What it means

Catch-all inside the doc-canvas read tool's execute: reading the persisted canvas projection from docReader threw, so the failure is logged and converted into a structured 'canvas could not be read' tool error for the model.

Source

Thrown at packages/backend/server/src/plugins/copilot/tools/doc-canvas-read.ts:343

  ) => Promise<CanvasReadResult>
) =>
  defineTool({
    description:
      'Read bounded structure from a persisted document canvas. Use overview first, then a frame, element ids, or region for detail. Use doc_read for Page text and frontend tools for unsynced editor state. Cursors are revision-bound.',
    inputSchema: z
      .object({
        doc_id: z.string().min(1).max(128),
        target: targetSchema,
        cursor: z.string().max(2048).optional(),
        limit: z.number().int().min(1).max(MAX_LIMIT).optional(),
      })
      .strict(),
    execute: async ({ doc_id, target, cursor, limit }) => {
      try {
        return await readCanvas(doc_id, target, cursor, limit);
      } catch {
        logger.error(`Failed to read canvas ${doc_id}: DOC_CANVAS_READ_FAILED`);
        return toolError(
          'Doc Canvas Read Failed',
          'The persisted canvas could not be read.',
          {
            code: 'DOC_CANVAS_READ_FAILED',
            retryable: false,
            locator: { doc_id },
          }
        );
      }
    },
  });

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Retry reading the persisted canvas; check storage availability.
  2. Verify the document id and workspace.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Returned as DOC_CANVAS_READ_FAILED when readCanvas throws unexpectedly inside the tool execute wrapper.

Common situations: An internal failure occurred loading the persisted canvas projection. Retry later; if persistent, check server logs for DOC_CANVAS_READ_FAILED.


AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18). Data as JSON: /api/errors/26940c9533c04801. Report an issue: GitHub.