chatboxai/chatbox · error
Session was not staged: ${descriptor.path}
Error message
Session was not staged: ${descriptor.path} What it means
Thrown in the restore loop when a manifest session descriptor's staged entry has no tempKey - the session.json was never staged into temp storage during reading. Reading always assigns a tempKey for session paths (lines 240-243), so this is a defensive guard against a staging/validation gap. Propagates after rollback.
Source
Thrown at src/renderer/packages/backup/import-backup.ts:312
for (const target of plan.targets) {
if (!target.needsWrite) continue
newResourceKeys.push(target.targetKey)
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)View on GitHub (pinned to 81571269ad)
Solutions
- Ensure the reading phase routes every isBackupSessionPath entry through the session staging branch.
- Do not skip validateManifestEntries before restore.
- Regenerate the backup.
- Report as a code defect if it reproduces with a valid archive.
Defensive patterns
Strategy: try-catch
Validate before calling
// No data fix; verify the reading phase staged every session with a tempKey.
for (const s of manifest.sessions) {
if (!stagedEntries.get(s.path)?.tempKey) throw new Error('Session not staged: ' + s.path)
} Try / catch
try {
await importBackupArchive(file, options)
} catch (error) {
if (error instanceof Error && error.message.startsWith('Session was not staged')) {
// Defensive guard; normally unreachable. Regenerate the backup and retry.
throw new Error('Session staging incomplete', { cause: error })
}
throw error
} Prevention
- Keep the session reading branch (isBackupSessionPath) assigning a tempKey for every session.json.
- Do not bypass validateManifestEntries before the restore loop.
- Avoid mutating stagedEntries mid-import.
When it happens
Trigger: stagedEntries.get(descriptor.path)?.tempKey is undefined for a session descriptor during the restore phase.
Common situations: Unreachable under the normal reading+validation flow because reading stages every session.json under a tempKey and validateManifestEntries confirms the entry is present. Reachable if validation is bypassed, the reading branch for sessions changes, or stagedEntries is mutated mid-import.
Related errors
- Resource was not staged: ${resource.path}
- Backup manifest entry list is incomplete
- Invalid session entry: ${entry.path}
- Session id does not match manifest: ${descriptor.path}
- Session is missing or invalid
AI-assisted analysis of chatboxai/chatbox@81571269ad (2026-08-12).
Data as JSON: /api/errors/932c2d1d6fd97e93.
Report an issue: GitHub.