toeverything/AFFiNE · error

OneNote import is only available in the desktop app.

Error message

OneNote import is only available in the desktop app.

What it means

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.

Source

Thrown at packages/frontend/core/src/modules/import/services/service.ts:142

    });
    if (BUILD_CONFIG.isElectron) {
      return commitNativeImport('bearZip', file, commitService, context);
    }

    await preflightWebZipImport(file);
    const snapshot = await snapshotFile(file);
    const { batch } = await BearTransformer.planBearBackup({
      collection,
      schema: getAFFiNEWorkspaceSchema(),
      imported: snapshot,
      extensions: getStoreManager().config.init().value.get('store'),
    });
    return commitService.commitBatch(batch);
  }

  async importOneNote(file: File, context?: ImportRunContext) {
    if (!BUILD_CONFIG.isElectron) {
      throw new Error('OneNote import is only available in the desktop app.');
    }
    const commitService = this.createCommitService({
      organize: true,
    });
    return commitNativeImport('oneNote', file, commitService, context);
  }

  private createCommitService(options: {
    organize?: boolean;
    explorerIcon?: boolean;
    tag?: boolean;
  }) {
    return new ImportCommitService({
      collection: this.workspaceService.workspace.docCollection,
      schema: getAFFiNEWorkspaceSchema(),
      extensions: getStoreManager().config.init().value.get('store'),
      organizeService: options.organize ? this.organizeService : undefined,
      explorerIconService: options.explorerIcon

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Use the AFFiNE desktop app to import OneNote files.
  2. Export the notebook to a supported format first.
Defensive patterns

Strategy: validation

When it happens

Trigger: 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.

Common situations: A user attempts to import a OneNote export in the browser version of AFFiNE. Use the desktop app to perform OneNote imports.


AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18). Data as JSON: /api/errors/267c2dc38974e610. Report an issue: GitHub.