toeverything/AFFiNE · error · Error

Recording doc is missing the page block

Error message

Recording doc is missing the page block

What it means

ensureNoteId requires the recording doc to contain an affine:page block to attach notes under; if none exists the doc is malformed or truncated and the error stops import instead of silently orphaning blocks.

Solutions

  1. Ensure the recording doc was fully created with its page block before importing.
  2. Re-create the recording doc if it is corrupted or partially synced.
  3. Check for sync issues that left the doc without its root page block.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/frontend/apps/electron-renderer/src/app/effects/recording.ts:117 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/6a54ae60ad8f16b6. Report an issue: GitHub.

Appendix: source

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

    },
  });

  return {
    timestamp,
    attachmentName:
      (status.appName ?? 'System Audio') + ' ' + timestamp + '.opus',
  };
}

function ensureNoteId(docStore: Store) {
  const [existingNote] = docStore.getModelsByFlavour('affine:note');
  if (existingNote) {
    return existingNote.id;
  }

  const [page] = docStore.getModelsByFlavour('affine:page');
  if (!page) {
    throw new Error('Recording doc is missing the page block');
  }

  return docStore.addBlock('affine:note', {}, page.id);
}

function findExistingAttachment(docStore: Store, attachmentName: string) {
  return (
    docStore.getModelsByFlavour('affine:attachment') as AttachmentBlockModel[]
  ).find(
    model =>
      model.props.name === attachmentName &&
      model.props.type === NATIVE_RECORDING_MIME_TYPE
  );
}

function ensureTranscriptionBlock(model: AttachmentBlockModel) {
  for (const key of model.childMap.value.keys()) {
    const block = model.store.getBlock$(key);

View on GitHub (pinned to b4c8548c09)