toeverything/AFFiNE · error · Error

Doc record not found

Error message

Doc record not found

What it means

DocsService.open throws when the doc list has no doc record for the given id, meaning the docId is unknown to the workspace (deleted or never existed); callers open docs by id assuming a record exists.

Source

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

    private readonly store: DocsStore,
    private readonly docPropertiesStore: DocPropertiesStore,
    private readonly docCreateMiddlewares: DocCreateMiddleware[]
  ) {
    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 {

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Verify the doc record exists in the workspace before accessing it.
  2. Refresh the doc list; the doc may have been deleted.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown by DocsService.open when the requested docId has no record in the workspace doc list (list.doc$ is null), meaning the doc metadata does not exist or has been deleted.

Common situations: A user opens a link or reference to a doc that was deleted or never synced to this workspace. Verify the doc exists in the page list and that sync has completed before reopening.


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