{"record":{"id":"267c2dc38974e610","repo":"toeverything/AFFiNE","slug":"onenote-import-is-only-available-in-the-desktop-ap","errorCode":null,"errorMessage":"OneNote import is only available in the desktop app.","messagePattern":"OneNote import is only available in the desktop app\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/frontend/core/src/modules/import/services/service.ts","lineNumber":142,"sourceCode":"    });\n    if (BUILD_CONFIG.isElectron) {\n      return commitNativeImport('bearZip', file, commitService, context);\n    }\n\n    await preflightWebZipImport(file);\n    const snapshot = await snapshotFile(file);\n    const { batch } = await BearTransformer.planBearBackup({\n      collection,\n      schema: getAFFiNEWorkspaceSchema(),\n      imported: snapshot,\n      extensions: getStoreManager().config.init().value.get('store'),\n    });\n    return commitService.commitBatch(batch);\n  }\n\n  async importOneNote(file: File, context?: ImportRunContext) {\n    if (!BUILD_CONFIG.isElectron) {\n      throw new Error('OneNote import is only available in the desktop app.');\n    }\n    const commitService = this.createCommitService({\n      organize: true,\n    });\n    return commitNativeImport('oneNote', file, commitService, context);\n  }\n\n  private createCommitService(options: {\n    organize?: boolean;\n    explorerIcon?: boolean;\n    tag?: boolean;\n  }) {\n    return new ImportCommitService({\n      collection: this.workspaceService.workspace.docCollection,\n      schema: getAFFiNEWorkspaceSchema(),\n      extensions: getStoreManager().config.init().value.get('store'),\n      organizeService: options.organize ? this.organizeService : undefined,\n      explorerIconService: options.explorerIcon","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/core/src/modules/import/services/service.ts#L124-L160","documentation":"A capability guard at the top of importOneNote: OneNote import requires native file-system access available only in the Electron desktop app. It fires when the method is invoked in a web build (BUILD_CONFIG.isElectron is false) — the caller attempted a OneNote import from the browser, which cannot be performed.","triggerScenarios":"Thrown by importOneNote when BUILD_CONFIG.isElectron is false, i.e. the OneNote import path requires the native desktop importer and is invoked from the web build.","commonSituations":"A user attempts to import a OneNote export in the browser version of AFFiNE. Use the desktop app to perform OneNote imports.","solutions":["Use the AFFiNE desktop app to import OneNote files.","Export the notebook to a supported format first."],"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"}