{"record":{"id":"143e443f7b7fe376","repo":"toeverything/AFFiNE","slug":"expected-a-single-zip-file-for-markdownzip-import","errorCode":null,"errorMessage":"Expected a single zip file for markdownZip import","messagePattern":"Expected a single zip file for markdownZip import","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/core/src/desktop/dialogs/import/index.tsx","lineNumber":313,"sourceCode":"          collection: docCollection,\n          schema: getAFFiNEWorkspaceSchema(),\n          markdown: text,\n          fileName,\n          extensions: getStoreManager().config.init().value.get('store'),\n        });\n        if (docId) docIds.push(docId);\n      }\n      return {\n        docIds,\n      };\n    },\n  },\n  markdownZip: {\n    fileOptions: { acceptType: 'Zip', multiple: false },\n    importFunction: async ({ files, importService, context }) => {\n      const file = files.length === 1 ? files[0] : null;\n      if (!file) {\n        throw new Error('Expected a single zip file for markdownZip import');\n      }\n      return requireImportService(importService).importMarkdownZip(\n        file,\n        context\n      );\n    },\n  },\n  html: {\n    fileOptions: { acceptType: 'Html', multiple: true },\n    importFunction: async ({ docCollection, files }) => {\n      const docIds: string[] = [];\n      for (const file of files) {\n        const text = await file.text();\n        const fileName = file.name.split('.').slice(0, -1).join('.');\n        const docId = await HtmlTransformer.importHTMLToDoc({\n          collection: docCollection,\n          schema: getAFFiNEWorkspaceSchema(),\n          extensions: getStoreManager().config.init().value.get('store'),","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/core/src/desktop/dialogs/import/index.tsx#L295-L331","documentation":"Thrown in the markdownZip import config when the file picker did not yield exactly one file (none or multiple), since markdown zip import accepts a single zip archive only; a caller-input contract violation.","triggerScenarios":"Thrown by the markdownZip import function when the picked file list does not contain exactly one file, violating the single-zip expectation.","commonSituations":"The user cancels the picker or selects zero/multiple files for a Markdown zip import. Select exactly one exported zip archive and retry.","solutions":["Select exactly one zip file for markdownZip import.","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-14T05:17:10.506Z"}