toeverything/AFFiNE · error · ToolError
DOC_READ_FAILED
DOC_READ_FAILED
Error message
The persisted Page content could not be read.
What it means
Catch-all in the doc_read tool's execute: the underlying getDoc call threw (storage/decode failure), so the error is logged with the doc id and a structured DOC_READ_FAILED tool error is returned to the model.
Source
Thrown at packages/backend/server/src/plugins/copilot/tools/doc-read.ts:140
.object({
doc_id: z
.string()
.min(1)
.max(128)
.describe('The persisted document to read'),
max_chars: z.number().int().min(1).max(100_000).optional(),
})
.strict(),
execute: async ({ doc_id, max_chars }) => {
try {
const doc = await getDoc(
doc_id,
Math.min(max_chars ?? 40_000, 100_000)
);
return isToolError(doc) ? doc : { ...doc };
} catch {
logger.error(`Failed to read doc ${doc_id}: DOC_READ_FAILED`);
return toolError(
'Doc Read Failed',
'The persisted Page content could not be read.',
{ code: 'DOC_READ_FAILED', retryable: false, locator: { doc_id } }
);
}
},
});
};
View on GitHub (pinned to b4c8548c09)
Solutions
- Retry reading the persisted page content; check storage health.
- Verify the document exists in the workspace.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Returned as DOC_READ_FAILED when getDoc throws unexpectedly while loading persisted page content inside the tool execute wrapper.
Common situations: An internal error prevented loading the page content for the copilot. Retry; if it persists, inspect server logs for DOC_READ_FAILED.
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/341c00f66f62bfbe.
Report an issue: GitHub.