toeverything/AFFiNE · error · Error

Recording import is missing docId

Error message

Recording import is missing docId

What it means

A state-shape guard in createRecordingDoc: the import pipeline persists a RecordingImportStatus whose docId should have been set by the earlier import steps before doc creation. It fires when that status object reaches createRecordingDoc with docId falsy — indicating the import state machine advanced to the create-doc phase without ever allocating a doc id.

Source

Thrown at packages/frontend/apps/electron-renderer/src/app/effects/recording.ts:162

    model.id
  );

  const block = model.store.getBlock(blockId)?.model as
    | TranscriptionBlockModel
    | undefined;
  if (!block) {
    throw new Error('Failed to create transcription block');
  }
  return block;
}

async function createRecordingDoc(
  frameworkProvider: FrameworkProvider,
  workspace: WorkspaceHandle['workspace'],
  status: RecordingImportStatus
) {
  if (!status.docId) {
    throw new Error('Recording import is missing docId');
  }

  const docsService = workspace.scope.get(DocsService);
  const aiEnabled = isAiEnabled(frameworkProvider);
  const { attachmentName, timestamp } = getAttachmentName(status);
  const targetDocId = status.docId;
  const docExists = !!docsService.list.doc$(targetDocId).value;

  if (!docExists) {
    const docProps: DocProps = {};
    docsService.createDoc({
      id: targetDocId,
      docProps,
      title:
        'Recording ' + (status.appName ?? 'System Audio') + ' ' + timestamp,
      primaryMode: 'page',
    });
  }

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Pass the target docId when starting a recording import.
  2. Check the import call site for a missing or renamed docId parameter.
  3. Ensure the recording session produced a doc before triggering the import.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/frontend/apps/electron-renderer/src/app/effects/recording.ts:162 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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