{"record":{"id":"8a28e8ff05e691cf","repo":"chatboxai/chatbox","slug":"session-metadata-id-does-not-match-session-id","errorCode":null,"errorMessage":"Session metadata id does not match: ${session.id}","messagePattern":"Session metadata id does not match: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/renderer/packages/backup/types.ts","lineNumber":100,"sourceCode":"  resources: z.array(BackupResourceEntrySchema).max(50_000),\n  warnings: z.array(BackupWarningSchema).max(50_000),\n  stats: z.object({\n    sessionCount: z.number().int().nonnegative(),\n    resourceCount: z.number().int().nonnegative(),\n    deduplicatedResourceCount: z.number().int().nonnegative(),\n    warningCount: z.number().int().nonnegative(),\n  }),\n})\nexport type BackupManifest = z.infer<typeof BackupManifestSchema>\n\nexport function validateBackupManifestGraph(manifest: BackupManifest): void {\n  const resourceIds = new Set<string>()\n  const resourceKeys = new Set<string>()\n  const sessionIds = new Set<string>()\n  for (const session of manifest.sessions) {\n    if (sessionIds.has(session.id)) throw new Error(`Duplicate session id in manifest: ${session.id}`)\n    sessionIds.add(session.id)\n    if (session.meta.id !== session.id) throw new Error(`Session metadata id does not match: ${session.id}`)\n  }\n  for (const resource of manifest.resources) {\n    if (resourceIds.has(resource.id)) throw new Error(`Duplicate resource id in manifest: ${resource.id}`)\n    resourceIds.add(resource.id)\n    const ownResourceKeys = new Set<string>()\n    for (const key of resource.originalStorageKeys) {\n      if (ownResourceKeys.has(key)) throw new Error(`Resource contains a duplicate storage key: ${resource.id}`)\n      ownResourceKeys.add(key)\n      if (resourceKeys.has(key)) throw new Error(`Duplicate resource storage key in manifest: ${key}`)\n      resourceKeys.add(key)\n    }\n    const ownSessionIds = new Set<string>()\n    for (const sessionId of resource.sessionIds) {\n      if (ownSessionIds.has(sessionId)) throw new Error(`Resource contains a duplicate session id: ${resource.id}`)\n      ownSessionIds.add(sessionId)\n      if (!sessionIds.has(sessionId)) throw new Error(`Resource references an unknown session: ${sessionId}`)\n    }\n    if (resource.scope === 'session' && resource.sessionIds.length !== 1) {","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/chatboxai/chatbox/blob/81571269addb6bafb589a920b2883f1e1e084fd1/src/renderer/packages/backup/types.ts#L82-L118","documentation":"Thrown when a session entry's id disagrees with its nested meta.id. The manifest stores the id both on the entry shell and inside the SessionMetaRecord; they must agree so restore can match metadata to the session's stored bytes.","triggerScenarios":"session.id !== session.meta.id — e.g. a session was copied and its shell id changed but meta.id wasn't, or metadata payloads were swapped between sessions during editing.","commonSituations":"Manual manifest editing; copy-pasting session entries; an exporter bug that writes the wrong meta payload.","solutions":["Reconcile session.id and session.meta.id so they are identical.","Re-export the affected session from the source.","If repairing deliberately, set session.meta.id = session.id (or vice versa) and keep one source of truth."],"exampleFix":"// before\n// manifest has session.id !== session.meta.id\n\n// after\nfor (const session of manifest.sessions) {\n  session.meta = { ...session.meta, id: session.id }\n}","handlingStrategy":"validation","validationCode":"function sessionIdsMatch(manifest: BackupManifest): boolean {\n  return manifest.sessions.every((s) => s.meta.id === s.id)\n}","typeGuard":null,"tryCatchPattern":"try {\n  validateBackupManifestGraph(manifest)\n} catch (error) {\n  if (/metadata id does not match/.test((error as Error).message)) attemptSessionRepair(manifest)\n  throw error\n}","preventionTips":["Treat session.id as the single source of truth and derive meta.id from it at export.","Re-validate after any manual manifest edit."],"tags":["backup","manifest","validation","data-integrity"],"backgroundTag":null,"analyzedSha":"81571269addb6bafb589a920b2883f1e1e084fd1","analyzedAt":"2026-08-12T21:51:44.981Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}