toeverything/AFFiNE · error · Error

Doc not found

Error message

Doc not found

What it means

DocsService.open validates both that a doc record exists in the list (else 'Doc record not found') and that a BlockSuite doc exists in the store; this Error fires for the latter — docId has a record but no underlying BlockSuite doc, so it cannot be opened.

Source

Thrown at packages/frontend/core/src/modules/doc/services/docs.ts:112

    super();
  }

  loaded(docId: string) {
    const exists = this.pool.get(docId);
    if (exists) {
      return { doc: exists.obj, release: exists.release };
    }
    return null;
  }

  open(docId: string) {
    const docRecord = this.list.doc$(docId).value;
    if (!docRecord) {
      throw new Error('Doc record not found');
    }
    const blockSuiteDoc = this.store.getBlockSuiteDoc(docId);
    if (!blockSuiteDoc) {
      throw new Error('Doc not found');
    }

    const exists = this.pool.get(docId);
    if (exists) {
      return { doc: exists.obj, release: exists.release };
    }

    const docScope = this.framework.createScope(DocScope, {
      docId,
      blockSuiteDoc,
      record: docRecord,
    });

    try {
      blockSuiteDoc.load();
    } catch (e) {
      logger.error('Failed to load doc', {
        docId,

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Check the doc id; the doc may have been removed.
  2. Refresh the doc list and retry.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown by DocsService.open when the doc record exists in the list but store.getBlockSuiteDoc returns null, i.e. the underlying BlockSuite doc store for the docId is missing.

Common situations: Happens when opening a doc whose metadata exists but whose content store failed to load or is absent, often from incomplete sync or storage corruption. Resync or reload the workspace and retry.


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