{"record":{"id":"1a54658491140d7f","repo":"jlcodes99/cockpit-tools","slug":"invalid-bundle-schema","errorCode":"invalid_bundle_schema","errorMessage":"invalid_bundle_schema","messagePattern":"invalid_bundle_schema","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/services/accountTransferService.ts","lineNumber":335,"sourceCode":"      account_count: accountCount,\n    },\n    platforms,\n  };\n}\n\nexport async function exportAllAccountsTransferJson(): Promise<string> {\n  const bundle = await buildAccountTransferBundle();\n  return JSON.stringify(bundle, null, 2);\n}\n\nfunction parseAccountTransferBundle(jsonContent: string): Record<PlatformId, AccountTransferPlatformPayload> {\n  const parsed = parseJsonOrThrow(jsonContent, 'invalid_json');\n  if (!isRecord(parsed)) {\n    throw new Error('invalid_bundle_root');\n  }\n\n  if (parsed.schema !== ACCOUNT_TRANSFER_SCHEMA) {\n    throw new Error('invalid_bundle_schema');\n  }\n\n  if (parsed.version !== ACCOUNT_TRANSFER_VERSION) {\n    throw new Error('invalid_bundle_version');\n  }\n\n  const rawPlatforms = parsed.platforms;\n  if (!isRecord(rawPlatforms)) {\n    throw new Error('invalid_bundle_platforms');\n  }\n\n  const platforms: Record<PlatformId, AccountTransferPlatformPayload> = {} as Record<\n    PlatformId,\n    AccountTransferPlatformPayload\n  >;\n\n  for (const platform of ALL_PLATFORM_IDS) {\n    const resolved = resolvePlatformPayload(rawPlatforms[platform]);","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/jlcodes99/cockpit-tools/blob/1ed8b77992d62ca81fabf744deb0839ad361d5bf/src/services/accountTransferService.ts#L317-L353","documentation":"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.","triggerScenarios":"parsed is a record but parsed.schema !== ACCOUNT_TRANSFER_SCHEMA — missing, misspelled, or from another schema family.","commonSituations":"Importing a bundle exported by another application, editing or deleting the schema field by hand, copying an example bundle with placeholder schema values.","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"],"exampleFix":"// before\n{ \"schema\": \"my-bundle\", \"version\": 1, ... }\n// after\n{ \"schema\": \"<ACCOUNT_TRANSFER_SCHEMA value>\", \"version\": 1, ... }","handlingStrategy":"validation","validationCode":"const obj = JSON.parse(text);\nif (obj.schema !== ACCOUNT_TRANSFER_SCHEMA) throw new Error('invalid_bundle_schema');","typeGuard":"function hasValidSchema(v: Record<string, unknown>, expected: unknown): boolean {\n  return v.schema === expected;\n}","tryCatchPattern":"try {\n  await importBundle(text);\n} catch (e) {\n  if (e instanceof Error && e.message === 'invalid_bundle_schema') {\n    alert('Bundle schema mismatch — re-export from this application.');\n  } else throw e;\n}","preventionTips":["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"],"tags":["validation","schema","versioning"],"backgroundTag":"schema-validation-failed","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"}