chatboxai/chatbox · error

Session id does not match manifest: ${descriptor.path}

Error message

Session id does not match manifest: ${descriptor.path}

What it means

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.

Source

Thrown at src/renderer/packages/backup/import-backup.ts:315

        await options.storage.setBlob(target.targetKey, value)
      }
      completedResources++
      options.onProgress?.({
        phase: 'restoring',
        current: completedResources,
        total: resourcePlans.length + manifest.sessions.length,
        label: plan.resource.filename,
      })
    }

    for (let index = 0; index < manifest.sessions.length; index++) {
      throwIfAborted(options.signal)
      const descriptor = manifest.sessions[index]
      const tempKey = stagedEntries.get(descriptor.path)?.tempKey
      if (!tempKey) throw new Error(`Session was not staged: ${descriptor.path}`)
      const stagedSession = await options.storage.getItem<Session | null>(tempKey, null)
      if (!isBackupSession(stagedSession) || stagedSession.id !== descriptor.id) {
        throw new Error(`Session id does not match manifest: ${descriptor.path}`)
      }
      let session = restoreSessionResourceKeys(stagedSession, resourceKeyMap)
      if (options.rehydrateSession) {
        const rehydrated = await options.rehydrateSession(session)
        session = rehydrated.session
        importWarnings.push(...rehydrated.warnings)
        if (rehydrated.rollback) rehydrationRollbacks.push(rehydrated.rollback)
      }
      await options.storage.setItemNow(backupSessionStorageKey(session.id), session)

      const meta = restoreSessionMetaResourceKeys(descriptor.meta, resourceKeyMap)
      const existingMeta = await options.metaStorage.getById(session.id)
      previousMeta.set(session.id, existingMeta)
      changedMetaIds.push(session.id)
      if (existingMeta) await options.metaStorage.update(session.id, meta)
      else await options.metaStorage.create(meta)
      options.onProgress?.({
        phase: 'restoring',

View on GitHub (pinned to 81571269ad)

Solutions

  1. Re-create the backup so manifest ids and session.json ids agree.
  2. If editing intentionally, keep descriptor.id and the session's id in sync.
  3. Verify the archive's integrity (the earlier checksum check passed) and trust the exporter's id assignment.
Defensive patterns

Strategy: try-catch

Validate before calling

// Before restore, confirm each staged session id matches its manifest descriptor id.
for (const d of manifest.sessions) {
  const staged = stagedEntries.get(d.path)
  if (!staged || !isBackupSession(staged.value) || staged.value.id !== d.id) {
    throw new Error('Session id mismatch for ' + d.path)
  }
}

Type guard

// True when the staged session satisfies the backup shape and its id matches the descriptor.
const sessionIdMatchesManifest = (
  value: unknown,
  descriptorId: string
): value is Session => isBackupSession(value) && value.id === descriptorId

Try / catch

try {
  await importBackupArchive(file, options)
} catch (error) {
  if (error instanceof Error && error.message.startsWith('Session id does not match manifest')) {
    // Manifest and session.json disagree; re-create the backup.
    throw new Error('Archive session/manifest id mismatch', { cause: error })
  }
  throw error
}

Prevention

When it happens

Trigger: storage.getItem(tempKey) returns a value that is not a valid backup session, or whose id !== descriptor.id.

Common situations: 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.

Related errors


AI-assisted analysis of chatboxai/chatbox@81571269ad (2026-08-12). Data as JSON: /api/errors/3b2b122510e755b8. Report an issue: GitHub.