{"record":{"id":"fda81a580c3eb8af","repo":"toeverything/AFFiNE","slug":"invalid-snapshot","errorCode":null,"errorMessage":"Invalid snapshot","messagePattern":"Invalid snapshot","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/frontend/core/src/components/affine/page-history-modal/data.ts","lineNumber":96,"sourceCode":"    workspaceId: string,\n    pageDocId: string,\n    ts: string,\n  ] // timestamp is the key to the history/snapshot\n) => {\n  if (!ts) {\n    return null;\n  }\n  const res = await fetchService.fetch(\n    `/api/workspaces/${workspaceId}/docs/${pageDocId}/histories/${ts}`\n  );\n\n  if (!res.ok) {\n    throw new Error('Failed to fetch snapshot');\n  }\n\n  const snapshot = await res.arrayBuffer();\n  if (!snapshot) {\n    throw new Error('Invalid snapshot');\n  }\n  return snapshot;\n};\n\n// attach the Page shown in the modal to a temporary workspace\n// so that we do not need to worry about providers etc\n// TODO(@Peng): fix references to the page (the referenced page will shown as deleted)\n// if we simply clone the current workspace, it maybe time consuming right?\nconst docCollectionMap = new Map<string, Workspace>();\n\n// assume the workspace is a cloud workspace since the history feature is only enabled for cloud workspace\nconst getOrCreateShellWorkspace = (\n  workspaceId: string,\n  flavourProvider?: WorkspaceFlavourProvider\n) => {\n  let docCollection = docCollectionMap.get(workspaceId);\n  if (!docCollection) {\n    docCollection = new WorkspaceImpl({","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/core/src/components/affine/page-history-modal/data.ts#L78-L114","documentation":"snapshotFetcher throws when the snapshot API responded ok but the returned arrayBuffer is empty, meaning the server returned an empty body for the requested history snapshot — the data is unusable for page-history preview.","triggerScenarios":"Thrown in the page history snapshotFetcher when the response arrayBuffer is falsy, meaning the server returned an empty or invalid snapshot payload.","commonSituations":"Occurs when a history entry loads but contains no snapshot data. Try another timestamp or report a corrupted history record.","solutions":["The snapshot data is corrupt or incompatible; pick another history entry.","Re-fetch the snapshot list and retry."],"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"}