{"record":{"id":"3b2b122510e755b8","repo":"chatboxai/chatbox","slug":"session-id-does-not-match-manifest-descriptor-p","errorCode":null,"errorMessage":"Session id does not match manifest: ${descriptor.path}","messagePattern":"Session id does not match manifest: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/renderer/packages/backup/import-backup.ts","lineNumber":315,"sourceCode":"        await options.storage.setBlob(target.targetKey, value)\n      }\n      completedResources++\n      options.onProgress?.({\n        phase: 'restoring',\n        current: completedResources,\n        total: resourcePlans.length + manifest.sessions.length,\n        label: plan.resource.filename,\n      })\n    }\n\n    for (let index = 0; index < manifest.sessions.length; index++) {\n      throwIfAborted(options.signal)\n      const descriptor = manifest.sessions[index]\n      const tempKey = stagedEntries.get(descriptor.path)?.tempKey\n      if (!tempKey) throw new Error(`Session was not staged: ${descriptor.path}`)\n      const stagedSession = await options.storage.getItem<Session | null>(tempKey, null)\n      if (!isBackupSession(stagedSession) || stagedSession.id !== descriptor.id) {\n        throw new Error(`Session id does not match manifest: ${descriptor.path}`)\n      }\n      let session = restoreSessionResourceKeys(stagedSession, resourceKeyMap)\n      if (options.rehydrateSession) {\n        const rehydrated = await options.rehydrateSession(session)\n        session = rehydrated.session\n        importWarnings.push(...rehydrated.warnings)\n        if (rehydrated.rollback) rehydrationRollbacks.push(rehydrated.rollback)\n      }\n      await options.storage.setItemNow(backupSessionStorageKey(session.id), session)\n\n      const meta = restoreSessionMetaResourceKeys(descriptor.meta, resourceKeyMap)\n      const existingMeta = await options.metaStorage.getById(session.id)\n      previousMeta.set(session.id, existingMeta)\n      changedMetaIds.push(session.id)\n      if (existingMeta) await options.metaStorage.update(session.id, meta)\n      else await options.metaStorage.create(meta)\n      options.onProgress?.({\n        phase: 'restoring',","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/chatboxai/chatbox/blob/81571269addb6bafb589a920b2883f1e1e084fd1/src/renderer/packages/backup/import-backup.ts#L297-L333","documentation":"Thrown in the restore loop when the session reloaded from temp storage either fails isBackupSession or has an id different from the manifest descriptor's id. The manifest's declared id must match the actual session.json content id. Propagates after rollback.","triggerScenarios":"storage.getItem(tempKey) returns a value that is not a valid backup session, or whose id !== descriptor.id.","commonSituations":"A tampered archive where the session.json id was changed after export but the manifest was not; temp storage corruption; a manifest/zip swap where descriptors and files come from different exports.","solutions":["Re-create the backup so manifest ids and session.json ids agree.","If editing intentionally, keep descriptor.id and the session's id in sync.","Verify the archive's integrity (the earlier checksum check passed) and trust the exporter's id assignment."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before restore, confirm each staged session id matches its manifest descriptor id.\nfor (const d of manifest.sessions) {\n  const staged = stagedEntries.get(d.path)\n  if (!staged || !isBackupSession(staged.value) || staged.value.id !== d.id) {\n    throw new Error('Session id mismatch for ' + d.path)\n  }\n}","typeGuard":"// True when the staged session satisfies the backup shape and its id matches the descriptor.\nconst sessionIdMatchesManifest = (\n  value: unknown,\n  descriptorId: string\n): value is Session => isBackupSession(value) && value.id === descriptorId","tryCatchPattern":"try {\n  await importBackupArchive(file, options)\n} catch (error) {\n  if (error instanceof Error && error.message.startsWith('Session id does not match manifest')) {\n    // Manifest and session.json disagree; re-create the backup.\n    throw new Error('Archive session/manifest id mismatch', { cause: error })\n  }\n  throw error\n}","preventionTips":["Never change a session's id without also updating the manifest entry.","Do not mix descriptors and files from different export runs.","Regenerate backups rather than hand-editing ids."],"tags":["backup","import","session","manifest","id-mismatch","validation"],"backgroundTag":null,"analyzedSha":"81571269addb6bafb589a920b2883f1e1e084fd1","analyzedAt":"2026-08-12T21:51:44.981Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}