{"record":{"id":"bd56fa5160fa2fdd","repo":"toeverything/AFFiNE","slug":"recording-import-is-missing-docid","errorCode":null,"errorMessage":"Recording import is missing docId","messagePattern":"Recording import is missing docId","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/apps/electron-renderer/src/app/effects/recording.ts","lineNumber":162,"sourceCode":"    model.id\n  );\n\n  const block = model.store.getBlock(blockId)?.model as\n    | TranscriptionBlockModel\n    | undefined;\n  if (!block) {\n    throw new Error('Failed to create transcription block');\n  }\n  return block;\n}\n\nasync function createRecordingDoc(\n  frameworkProvider: FrameworkProvider,\n  workspace: WorkspaceHandle['workspace'],\n  status: RecordingImportStatus\n) {\n  if (!status.docId) {\n    throw new Error('Recording import is missing docId');\n  }\n\n  const docsService = workspace.scope.get(DocsService);\n  const aiEnabled = isAiEnabled(frameworkProvider);\n  const { attachmentName, timestamp } = getAttachmentName(status);\n  const targetDocId = status.docId;\n  const docExists = !!docsService.list.doc$(targetDocId).value;\n\n  if (!docExists) {\n    const docProps: DocProps = {};\n    docsService.createDoc({\n      id: targetDocId,\n      docProps,\n      title:\n        'Recording ' + (status.appName ?? 'System Audio') + ' ' + timestamp,\n      primaryMode: 'page',\n    });\n  }","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/apps/electron-renderer/src/app/effects/recording.ts#L144-L180","documentation":"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.","triggerScenarios":"Thrown at packages/frontend/apps/electron-renderer/src/app/effects/recording.ts:162 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the target docId when starting a recording import.","Check the import call site for a missing or renamed docId parameter.","Ensure the recording session produced a doc before triggering the import."],"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-14T00:17:10.932Z"}