{"record":{"id":"39c7633bba843db7","repo":"toeverything/AFFiNE","slug":"expected-a-single-zip-file-for-snapshot-import","errorCode":null,"errorMessage":"Expected a single zip file for snapshot import","messagePattern":"Expected a single zip file for snapshot import","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/core/src/desktop/dialogs/import/index.tsx","lineNumber":406,"sourceCode":"      const docIds: string[] = [];\n      for (const file of files) {\n        const docId = await DocxTransformer.importDocx({\n          collection: docCollection,\n          schema: getAFFiNEWorkspaceSchema(),\n          imported: file,\n          extensions: getStoreManager().config.init().value.get('store'),\n        });\n        if (docId) docIds.push(docId);\n      }\n      return { docIds };\n    },\n  },\n  snapshot: {\n    fileOptions: { acceptType: 'Zip', multiple: false },\n    importFunction: async ({ docCollection, files }) => {\n      const file = files.length === 1 ? files[0] : null;\n      if (!file) {\n        throw new Error('Expected a single zip file for snapshot import');\n      }\n      const docIds = (\n        await ZipTransformer.importDocs(\n          docCollection,\n          getAFFiNEWorkspaceSchema(),\n          file\n        )\n      )\n        .filter((doc): doc is NonNullable<typeof doc> => doc !== undefined)\n        .map(doc => doc.id);\n\n      return {\n        docIds,\n      };\n    },\n  },\n  dotaffinefile: {\n    fileOptions: { acceptType: 'Skip', multiple: false },","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/core/src/desktop/dialogs/import/index.tsx#L388-L424","documentation":"Guard in the snapshot import config: a workspace snapshot import expects exactly one zip archive; any other selection size means there is no snapshot payload to restore, so the config throws before delegating to the snapshot importer.","triggerScenarios":"Thrown by the snapshot import function when files.length is not exactly one, because ZipTransformer.importDocs consumes a single snapshot zip.","commonSituations":"A workspace snapshot import was started without selecting exactly one zip. Choose one previously exported AFFiNE snapshot zip file.","solutions":["Select exactly one zip snapshot file.","Re-pick the file in the import dialog."],"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"}