jlcodes99/cockpit-tools · warning
[ExternalImport][App] 当前版本不支持外部导入方式,已终止导入
Error message
[ExternalImport][App] 当前版本不支持外部导入方式,已终止导入
What it means
App.tsx's external provider-import entrypoint first checks that the incoming import payload's requiredVersion is compatible with the current app version (ensureExternalImportVersionCompatible). When the check fails (required version higher than the running app, or no supported version at all), it shows a close-only dialog and logs this warning, then aborts the import by returning false.
Source
Thrown at src/App.tsx:959
id: 'check-update',
label: t('common.shared.externalImport.checkUpdate', '检查更新'),
variant: 'primary',
onClick: () => {
window.dispatchEvent(
new CustomEvent('update-check-requested', {
detail: { source: 'manual' satisfies UpdateCheckSource },
}),
);
},
},
{
id: 'close',
label: t('common.close', '关闭'),
variant: 'secondary',
},
],
});
console.warn('[ExternalImport][App] 当前版本不支持外部导入方式,已终止导入', {
currentVersion: currentVersion || null,
requiredVersion,
providerId: payload.providerId,
});
return false;
},
[showModal, t],
);
const handleExternalProviderImportRawPayload = useCallback(async (rawPayload: unknown) => {
console.info('[ExternalImport][App] 收到原始 payload:', rawPayload);
const normalized = normalizeExternalProviderImportPayload(rawPayload);
if (!normalized) {
console.warn('[ExternalImport][App] payload 归一化失败,已忽略');
return;
}
if (!(await ensureExternalImportVersionCompatible(normalized))) {
return;View on GitHub (pinned to 1ed8b77992)
Solutions
- Upgrade Cockpit Tools to at least the requiredVersion reported in the warning payload.
- Ask the exporter to re-export using an app version compatible with yours (lower requiredVersion).
- If versions look compatible, check version comparison logic for formatting mismatches (semver normalization).
- Manually recreate the provider in CodexModelProviderManager as a workaround.
Example fix
null
Defensive patterns
Strategy: validation
Validate before calling
function isVersionCompatible(current: string, required: string): boolean {
const cmp = (s: string) => s.split('.').map(Number);
const [c, r] = [cmp(current), cmp(required)];
for (let i = 0; i < 3; i++) {
if ((r[i] ?? 0) > (c[i] ?? 0)) return false;
}
return true;
}
if (!isVersionCompatible(currentVersion, payload.requiredVersion)) return false;
Type guard
function hasRequiredVersion(p: unknown): p is { requiredVersion: string } {
return !!p && typeof p === 'object' &&
typeof (p as any).requiredVersion === 'string' &&
/^\d+(\.\d+)*$/.test((p as any).requiredVersion);
}
Try / catch
// version gate is pre-checked; wrap import for residual errors
if (!(await ensureExternalImportVersionCompatible(normalized))) return false;
try {
await importProvider(normalized);
} catch (e) {
console.warn('[ExternalImport][App] 导入失败', e);
return false;
} Prevention
- Check app version before sharing export files between machines
- Normalize version strings (semver) before comparison
- Show the required version in the error dialog so users know what to upgrade to
When it happens
Trigger: An external import payload (e.g. from a shared link/file carrying providerId and requiredVersion) is received whose requiredVersion exceeds currentVersion, so handleExternalProviderImportRawPayload bails out before importing.
Common situations: Trying to import a provider configuration exported from a newer app version; version string mismatches (e.g. '1.2' vs '1.2.0'); payload hand-edited with an unsupported version field.
Related errors
- invalidJsonMessage
- messages.noItems
- messages.providerMismatch
- [ExternalImport][App] payload 归一化失败,已忽略
- 未找到有效 Token {:?}
AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05).
Data as JSON: /api/errors/d48d07bdafaa1a17.
Report an issue: GitHub.