{"record":{"id":"b6f9c1e7b69b2ce5","repo":"jlcodes99/cockpit-tools","slug":"common-shared-externalimport-bundleempty","errorCode":"common.shared.externalImport.bundleEmpty","errorMessage":"common.shared.externalImport.bundleEmpty (导入包内容为空)","messagePattern":"common\\.shared\\.externalImport\\.bundleEmpty \\(导入包内容为空\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/hooks/useProviderAccountsPage.ts","lineNumber":1632,"sourceCode":"\n      void (async () => {\n        try {\n          let content = request.token.trim();\n          if (importUrl) {\n            updateProgress({\n              status: 'fetching',\n              progress: 20,\n              message: t(\n                'common.shared.externalImport.statusFetching',\n                '正在获取导入包...',\n              ),\n            });\n            content = await invoke<string>('external_import_fetch_import_url', {\n              importUrl,\n            });\n          }\n          if (!content.trim()) {\n            throw new Error(t('common.shared.externalImport.bundleEmpty', '导入包内容为空'));\n          }\n\n          updateProgress({\n            status: 'parsing',\n            progress: 35,\n            message: t(\n              'common.shared.externalImport.statusParsing',\n              '正在解析 Codex JSON...',\n            ),\n          });\n          const resolvedItems = resolveExternalImportBundleItems(content, platformId, {\n            invalidJson: t(\n              'common.shared.externalImport.bundleInvalidJson',\n              '导入包不是有效 JSON',\n            ),\n            empty: t('common.shared.externalImport.bundleEmpty', '导入包内容为空'),\n            providerMismatch: t(\n              'common.shared.externalImport.bundleProviderMismatch',","sourceCodeStart":1614,"sourceCodeEnd":1650,"githubUrl":"https://github.com/jlcodes99/cockpit-tools/blob/1ed8b77992d62ca81fabf744deb0839ad361d5bf/src/hooks/useProviderAccountsPage.ts#L1614-L1650","documentation":"Sentinel guard in the external import flow: after optionally fetching the bundle from importUrl via 'external_import_fetch_import_url' (or using the pasted token), the resulting content trims to an empty string. It fires when the fetch backend returns empty output or the user submits only whitespace, so there is no bundle to parse.","triggerScenarios":"Thrown at src/hooks/useProviderAccountsPage.ts:1632 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the import URL points to a reachable, non-empty bundle file","Verify the backend 'external_import_fetch_import_url' command returns the full body and does not swallow content on redirects","Re-paste the import token; leading/trailing whitespace-only input is rejected"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1ed8b77992d62ca81fabf744deb0839ad361d5bf","analyzedAt":"2026-09-05T09:51:41.178Z","contentChangedAt":"2026-09-05T09:51:41.178Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}