{"record":{"id":"d3a62d2dbc37048f","repo":"toeverything/AFFiNE","slug":"expected-a-single-onenote-file","errorCode":null,"errorMessage":"Expected a single OneNote file","messagePattern":"Expected a single OneNote file","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/core/src/desktop/dialogs/import/index.tsx","lineNumber":380,"sourceCode":"    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 .bear2bk file for Bear import');\n      }\n      return requireImportService(importService).importBearBackup(\n        file,\n        context\n      );\n    },\n  },\n  oneNote: {\n    fileOptions: { acceptType: 'OneNote', multiple: false },\n    nativeOnly: true,\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 OneNote file');\n      }\n      return requireImportService(importService).importOneNote(file, context);\n    },\n  },\n  docx: {\n    fileOptions: { acceptType: 'Docx', multiple: false },\n    importFunction: async ({ docCollection, files }) => {\n      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 };","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/core/src/desktop/dialogs/import/index.tsx#L362-L398","documentation":"Guard in the oneNote import config: the OneNote importer accepts exactly one exported OneNote file; if the selection does not contain exactly one file the import cannot proceed and the config throws instead of invoking the native importer.","triggerScenarios":"Thrown by the OneNote import function when the picked file list does not hold exactly one file, as the importer expects a single OneNote export.","commonSituations":"OneNote import was attempted with zero or multiple files selected. Pick a single OneNote export file in the desktop app and retry.","solutions":["Select exactly one OneNote file for 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"}