chatboxai/chatbox · error
Duplicate resource storage key in manifest: ${key}
Error message
Duplicate resource storage key in manifest: ${key} What it means
Thrown when a storage key appears in originalStorageKeys across two different resources. The manifest treats storage keys as globally unique (one physical blob per key), so any cross-resource reuse is rejected.
Source
Thrown at src/renderer/packages/backup/types.ts:109
export type BackupManifest = z.infer<typeof BackupManifestSchema>
export function validateBackupManifestGraph(manifest: BackupManifest): void {
const resourceIds = new Set<string>()
const resourceKeys = new Set<string>()
const sessionIds = new Set<string>()
for (const session of manifest.sessions) {
if (sessionIds.has(session.id)) throw new Error(`Duplicate session id in manifest: ${session.id}`)
sessionIds.add(session.id)
if (session.meta.id !== session.id) throw new Error(`Session metadata id does not match: ${session.id}`)
}
for (const resource of manifest.resources) {
if (resourceIds.has(resource.id)) throw new Error(`Duplicate resource id in manifest: ${resource.id}`)
resourceIds.add(resource.id)
const ownResourceKeys = new Set<string>()
for (const key of resource.originalStorageKeys) {
if (ownResourceKeys.has(key)) throw new Error(`Resource contains a duplicate storage key: ${resource.id}`)
ownResourceKeys.add(key)
if (resourceKeys.has(key)) throw new Error(`Duplicate resource storage key in manifest: ${key}`)
resourceKeys.add(key)
}
const ownSessionIds = new Set<string>()
for (const sessionId of resource.sessionIds) {
if (ownSessionIds.has(sessionId)) throw new Error(`Resource contains a duplicate session id: ${resource.id}`)
ownSessionIds.add(sessionId)
if (!sessionIds.has(sessionId)) throw new Error(`Resource references an unknown session: ${sessionId}`)
}
if (resource.scope === 'session' && resource.sessionIds.length !== 1) {
throw new Error(`Session-scoped resource must reference exactly one session: ${resource.id}`)
}
if (resource.scope === 'global' && resource.sessionIds.length !== 0) {
throw new Error(`Global resource must not reference a session: ${resource.id}`)
}
}
const resourcesById = new Map(manifest.resources.map((resource) => [resource.id, resource]))
const sessionsById = new Map(manifest.sessions.map((session) => [session.id, session]))
for (const session of manifest.sessions) {View on GitHub (pinned to 81571269ad)
Solutions
- Pick one resource to own the key and remove it from the other.
- Re-export with global storage-key deduplication.
- Verify the storage backend doesn't alias keys.
Example fix
// before
validateBackupManifestGraph(manifest)
// after
const claimed = new Set<string>()
for (const r of manifest.resources) {
r.originalStorageKeys = r.originalStorageKeys.filter((k) =>
claimed.has(k) ? false : (claimed.add(k), true)
)
} Defensive patterns
Strategy: validation
Validate before calling
function findSharedStorageKeys(manifest: BackupManifest): string[] {
const seen = new Set<string>()
const dups = new Set<string>()
for (const r of manifest.resources) for (const k of r.originalStorageKeys) (seen.has(k) ? dups : seen).add(k)
return [...dups]
} Try / catch
try {
validateBackupManifestGraph(manifest)
} catch (error) {
if (/Duplicate resource storage key/.test((error as Error).message)) reportSharedStorageKey(error)
throw error
} Prevention
- Deduplicate storage keys globally at export, not just per resource.
- Confirm the storage backend does not alias the same blob under two keys.
When it happens
Trigger: Two distinct resource entries both list the same key in their originalStorageKeys.
Common situations: Two resources point at the same underlying blob; exporter failed to deduplicate storage keys globally; merge of backups that share storage.
Related errors
- Duplicate session id in manifest: ${session.id}
- Duplicate resource id in manifest: ${resource.id}
- Resource contains a duplicate storage key: ${resource.id}
- Resource contains a duplicate session id: ${resource.id}
- Session contains a duplicate resource id: ${session.id}
AI-assisted analysis of chatboxai/chatbox@81571269ad (2026-08-12).
Data as JSON: /api/errors/ccdcd61b87377165.
Report an issue: GitHub.