jlcodes99/cockpit-tools · error
invalid_bundle_schema
invalid_bundle_schema
Error message
invalid_bundle_schema
What it means
Sentinel error in parseAccountTransferBundle: the transfer JSON parsed and has a valid root object, but its schema field does not match ACCOUNT_TRANSFER_SCHEMA. It fires when importing an account-transfer bundle exported by an incompatible version of the app, so the payload layout cannot be trusted and the import is rejected outright.
Source
Thrown at src/services/accountTransferService.ts:335
account_count: accountCount,
},
platforms,
};
}
export async function exportAllAccountsTransferJson(): Promise<string> {
const bundle = await buildAccountTransferBundle();
return JSON.stringify(bundle, null, 2);
}
function parseAccountTransferBundle(jsonContent: string): Record<PlatformId, AccountTransferPlatformPayload> {
const parsed = parseJsonOrThrow(jsonContent, 'invalid_json');
if (!isRecord(parsed)) {
throw new Error('invalid_bundle_root');
}
if (parsed.schema !== ACCOUNT_TRANSFER_SCHEMA) {
throw new Error('invalid_bundle_schema');
}
if (parsed.version !== ACCOUNT_TRANSFER_VERSION) {
throw new Error('invalid_bundle_version');
}
const rawPlatforms = parsed.platforms;
if (!isRecord(rawPlatforms)) {
throw new Error('invalid_bundle_platforms');
}
const platforms: Record<PlatformId, AccountTransferPlatformPayload> = {} as Record<
PlatformId,
AccountTransferPlatformPayload
>;
for (const platform of ALL_PLATFORM_IDS) {
const resolved = resolvePlatformPayload(rawPlatforms[platform]);View on GitHub (pinned to 1ed8b77992)
Solutions
- Check the bundle's schema field and set it to the value of ACCOUNT_TRANSFER_SCHEMA in this build
- Re-export the bundle from the same application version
- If the schema genuinely differs, write a converter to map the foreign schema to this one before import
- Verify no find-and-replace or editor tooling stripped or renamed the schema field
Example fix
// before
{ "schema": "my-bundle", "version": 1, ... }
// after
{ "schema": "<ACCOUNT_TRANSFER_SCHEMA value>", "version": 1, ... } Defensive patterns
Strategy: validation
Validate before calling
const obj = JSON.parse(text);
if (obj.schema !== ACCOUNT_TRANSFER_SCHEMA) throw new Error('invalid_bundle_schema'); Type guard
function hasValidSchema(v: Record<string, unknown>, expected: unknown): boolean {
return v.schema === expected;
} Try / catch
try {
await importBundle(text);
} catch (e) {
if (e instanceof Error && e.message === 'invalid_bundle_schema') {
alert('Bundle schema mismatch — re-export from this application.');
} else throw e;
} Prevention
- Never hand-edit the schema field of a bundle
- Re-export bundles after upgrading the application
- Verify the bundle was produced by this tool family, not another app
- Keep the exported schema constant in sync across builds
When it happens
Trigger: parsed is a record but parsed.schema !== ACCOUNT_TRANSFER_SCHEMA — missing, misspelled, or from another schema family.
Common situations: Importing a bundle exported by another application, editing or deleting the schema field by hand, copying an example bundle with placeholder schema values.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- invalid_bundle_version
- invalid_bundle_root
- invalid_bundle_platforms
- backup_accounts_missing
- [ExternalImport][App] payload 归一化失败,已忽略
AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05).
Data as JSON: /api/errors/1a54658491140d7f.
Report an issue: GitHub.