{"record":{"id":"6a54ae60ad8f16b6","repo":"toeverything/AFFiNE","slug":"recording-doc-is-missing-the-page-block","errorCode":null,"errorMessage":"Recording doc is missing the page block","messagePattern":"Recording doc is missing the page block","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/apps/electron-renderer/src/app/effects/recording.ts","lineNumber":117,"sourceCode":"    },\n  });\n\n  return {\n    timestamp,\n    attachmentName:\n      (status.appName ?? 'System Audio') + ' ' + timestamp + '.opus',\n  };\n}\n\nfunction ensureNoteId(docStore: Store) {\n  const [existingNote] = docStore.getModelsByFlavour('affine:note');\n  if (existingNote) {\n    return existingNote.id;\n  }\n\n  const [page] = docStore.getModelsByFlavour('affine:page');\n  if (!page) {\n    throw new Error('Recording doc is missing the page block');\n  }\n\n  return docStore.addBlock('affine:note', {}, page.id);\n}\n\nfunction findExistingAttachment(docStore: Store, attachmentName: string) {\n  return (\n    docStore.getModelsByFlavour('affine:attachment') as AttachmentBlockModel[]\n  ).find(\n    model =>\n      model.props.name === attachmentName &&\n      model.props.type === NATIVE_RECORDING_MIME_TYPE\n  );\n}\n\nfunction ensureTranscriptionBlock(model: AttachmentBlockModel) {\n  for (const key of model.childMap.value.keys()) {\n    const block = model.store.getBlock$(key);","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/apps/electron-renderer/src/app/effects/recording.ts#L99-L135","documentation":"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.","triggerScenarios":"Thrown at packages/frontend/apps/electron-renderer/src/app/effects/recording.ts:117 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the recording doc was fully created with its page block before importing.","Re-create the recording doc if it is corrupted or partially synced.","Check for sync issues that left the doc without its root page block."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}