{"record":{"id":"09fb56cdbd93eac1","repo":"toeverything/AFFiNE","slug":"native-import-requires-a-local-file-source","errorCode":null,"errorMessage":"Native import requires a local file source","messagePattern":"Native import requires a local file source","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/frontend/apps/electron/src/preload/electron-api.ts","lineNumber":328,"sourceCode":"  if (source.kind === 'file') {\n    const path = filePathFromFile(source.file);\n    return path ? { kind: 'filePath', path } : null;\n  }\n  const path = directoryPathFromFiles(source.files);\n  return path ? { kind: 'directoryPath', path } : null;\n}\n\nexport const apis = {\n  ...mainAPIs.apis,\n  ...helperAPIs.apis,\n  import: {\n    ...mainAPIs.apis.import,\n    createImportSessionFromSource(\n      options: CreateImportSessionFromSourceOptions\n    ) {\n      const source = resolveNativeImportSource(options.source);\n      if (!source) {\n        throw new Error('Native import requires a local file source');\n      }\n      return mainAPIs.apis.import.createImportSession({\n        format: options.format,\n        source,\n        batchLimits: options.batchLimits,\n      });\n    },\n  },\n};\n\nexport const events = {\n  ...mainAPIs.events,\n  ...helperAPIs.events,\n};\n","sourceCodeStart":310,"sourceCodeEnd":343,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/apps/electron/src/preload/electron-api.ts#L310-L343","documentation":"createImportSessionFromSource resolves the import source to a local file/directory path and throws when the source is not local (e.g. remote or cloud content), since native import only operates on filesystem paths.","triggerScenarios":"Thrown at packages/frontend/apps/electron/src/preload/electron-api.ts:328 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Import from a local file path when using the native import API.","Download the remote content to a local file first, then import it.","Check the import call site to ensure a file source is passed instead of a URL or blob."],"exampleFix":null,"handlingStrategy":"type-guard","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"}