{"record":{"id":"1ded58b0688663f7","repo":"toeverything/AFFiNE","slug":"import-service-is-unavailable","errorCode":null,"errorMessage":"Import service is unavailable","messagePattern":"Import service is unavailable","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/core/src/desktop/dialogs/import/index.tsx","lineNumber":140,"sourceCode":"    };\n  }\n  if (error instanceof Error) {\n    return {\n      code: error.name || 'import-error',\n      message: error.message || 'Unknown error occurred',\n      sourcePath,\n    };\n  }\n  return {\n    code: 'unknown',\n    message: 'Unknown error occurred',\n    sourcePath,\n  };\n}\n\nfunction requireImportService(importService?: ImportService) {\n  if (!importService) {\n    throw new Error('Import service is unavailable');\n  }\n  return importService;\n}\n\ntype ImportConfig = {\n  fileOptions: { acceptType: AcceptType; multiple: boolean };\n  nativeOnly?: boolean;\n  importFunction: (args: ImportFunctionArgs) => Promise<ImportResult>;\n};\n\nconst importOptions = [\n  {\n    key: 'markdown',\n    label: 'com.affine.import.markdown-files',\n    prefixIcon: (\n      <ExportToMarkdownIcon\n        color={cssVarV2('icon/primary')}\n        width={20}","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/core/src/desktop/dialogs/import/index.tsx#L122-L158","documentation":"requireImportService is a dependency guard: it throws when the ImportService could not be obtained from the framework context (e.g. import dialogs rendered outside a workspace scope), preventing null-service crashes later in the import flow.","triggerScenarios":"Thrown by requireImportService when an import function is invoked without an ImportService instance, i.e. the desktop/native import bridge was not provided to the dialog.","commonSituations":"The user picks an import type that needs the native import service while running in a context where it is missing. Use the desktop app or reload the workspace before importing.","solutions":["Retry after the import service initializes.","Restart the app if the service remains unavailable."],"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-14T00:17:10.932Z"}