{"record":{"id":"0c20fb9de24552ab","repo":"toeverything/AFFiNE","slug":"failed-to-get-snapshot-0c20fb","errorCode":null,"errorMessage":"Failed to get snapshot","messagePattern":"Failed to get snapshot","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/core/src/modules/comment/entities/doc-comment.ts","lineNumber":194,"sourceCode":"    type: 'comment' | 'reply',\n    snapshot: DocSnapshot,\n    attachments: CommentAttachment[]\n  ): Promise<void> {\n    const doc = await this.snapshotHelper.createStore(snapshot);\n    if (!doc) {\n      throw new Error('Failed to create doc for editing');\n    }\n    this.editingDraft$.setValue({ id, type, doc, attachments });\n  }\n\n  /** Commit current editing draft (if any) */\n  async commitEditing(): Promise<void> {\n    const draft = this.editingDraft$.value;\n    if (!draft) return;\n\n    const snapshot = this.snapshotHelper.getSnapshot(draft.doc);\n    if (!snapshot) {\n      throw new Error('Failed to get snapshot');\n    }\n\n    if (draft.type === 'comment') {\n      await this.updateComment(draft.id, {\n        snapshot,\n        attachments: draft.attachments,\n      });\n    } else {\n      await this.updateReply(draft.id, {\n        snapshot,\n        attachments: draft.attachments,\n      });\n    }\n    track.$.commentPanel.$.editComment({\n      type: draft.type === 'comment' ? 'root' : 'node',\n    });\n    this.editingDraft$.setValue(null);\n    this.revalidate();","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/core/src/modules/comment/entities/doc-comment.ts#L176-L212","documentation":"commitEditing extracts a snapshot from the editing draft's temp doc via snapshotHelper.getSnapshot; a null result means the snapshot could not be serialized, so the edit cannot be committed and this Error is thrown.","triggerScenarios":"Thrown in commitEditing when snapshotHelper.getSnapshot returns null for the current editing draft doc, so the edited comment content cannot be serialized back to a snapshot before updating the comment or reply.","commonSituations":"Occurs when saving an edited comment or reply fails because the editor doc state could not be snapshotted, typically due to a broken draft doc. Dismiss the edit and redo the changes, then retry committing.","solutions":["Ensure the comment doc is loaded before requesting a snapshot.","Retry after sync completes."],"exampleFix":null,"handlingStrategy":"type-guard","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"}