toeverything/AFFiNE · error · Error

Expected a single OneNote file

Error message

Expected a single OneNote file

What it means

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.

Solutions

  1. Select exactly one OneNote file for import.
  2. Re-pick the file in the import dialog.
Defensive patterns

Strategy: validation

When it happens

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

Common situations: OneNote import was attempted with zero or multiple files selected. Pick a single OneNote export file in the desktop app and retry.


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

Appendix: source

Thrown at packages/frontend/core/src/desktop/dialogs/import/index.tsx:380

    fileOptions: { acceptType: 'Zip', multiple: false },
    importFunction: async ({ files, importService, context }) => {
      const file = files.length === 1 ? files[0] : null;
      if (!file) {
        throw new Error('Expected a single .bear2bk file for Bear import');
      }
      return requireImportService(importService).importBearBackup(
        file,
        context
      );
    },
  },
  oneNote: {
    fileOptions: { acceptType: 'OneNote', multiple: false },
    nativeOnly: true,
    importFunction: async ({ files, importService, context }) => {
      const file = files.length === 1 ? files[0] : null;
      if (!file) {
        throw new Error('Expected a single OneNote file');
      }
      return requireImportService(importService).importOneNote(file, context);
    },
  },
  docx: {
    fileOptions: { acceptType: 'Docx', multiple: false },
    importFunction: async ({ docCollection, files }) => {
      const docIds: string[] = [];
      for (const file of files) {
        const docId = await DocxTransformer.importDocx({
          collection: docCollection,
          schema: getAFFiNEWorkspaceSchema(),
          imported: file,
          extensions: getStoreManager().config.init().value.get('store'),
        });
        if (docId) docIds.push(docId);
      }
      return { docIds };

View on GitHub (pinned to b4c8548c09)