chatboxai/chatbox · error
Resource/session mapping is inconsistent: ${resource.id}/${s
Error message
Resource/session mapping is inconsistent: ${resource.id}/${sessionId} What it means
Thrown for the reverse-link mismatch: resource R lists session S, but S.resourceIds does not include R. This is the symmetric counterpart to error 152 and catches resources that claim a session which doesn't claim them back.
Source
Thrown at src/renderer/packages/backup/types.ts:142
}
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) {
const ownResourceIds = new Set<string>()
for (const resourceId of session.resourceIds) {
if (ownResourceIds.has(resourceId)) throw new Error(`Session contains a duplicate resource id: ${session.id}`)
ownResourceIds.add(resourceId)
if (!resourceIds.has(resourceId)) throw new Error(`Session references an unknown resource: ${resourceId}`)
if (!resourcesById.get(resourceId)?.sessionIds.includes(session.id)) {
throw new Error(`Session/resource mapping is inconsistent: ${session.id}/${resourceId}`)
}
}
}
for (const resource of manifest.resources) {
for (const sessionId of resource.sessionIds) {
const session = sessionsById.get(sessionId)
if (!session?.resourceIds.includes(resource.id)) {
throw new Error(`Resource/session mapping is inconsistent: ${resource.id}/${sessionId}`)
}
}
}
if (
manifest.stats.sessionCount !== manifest.sessions.length ||
manifest.stats.resourceCount !== manifest.resources.length ||
manifest.stats.warningCount !== manifest.warnings.length
) {
throw new Error('Backup manifest statistics do not match its entries')
}
}
export interface BackupProgress {
phase: 'preparing' | 'sessions' | 'resources' | 'packing' | 'reading' | 'validating' | 'restoring'
current: number
total: number
label?: string
}View on GitHub (pinned to 81571269ad)
Solutions
- Add resource.id to the session's resourceIds.
- Or remove sessionId from the resource's sessionIds if the link is spurious.
- Re-export to regenerate both directions.
Example fix
// before
// resource->session link exists, but session->resource does not
// after
const sessionsById = new Map(manifest.sessions.map((s) => [s.id, s]))
for (const r of manifest.resources) {
for (const sid of r.sessionIds) {
const s = sessionsById.get(sid)
if (s && !s.resourceIds.includes(r.id)) s.resourceIds.push(r.id)
}
} Defensive patterns
Strategy: try-catch
Validate before calling
function reverseLinksAreSymmetric(manifest: BackupManifest): boolean {
const sessionsById = new Map(manifest.sessions.map((s) => [s.id, s]))
return manifest.resources.every((r) =>
r.sessionIds.every((sid) => sessionsById.get(sid)?.resourceIds.includes(r.id))
)
} Try / catch
try {
validateBackupManifestGraph(manifest)
} catch (error) {
if (/Resource\/session mapping is inconsistent/.test((error as Error).message)) symmetrizeLinks(manifest)
throw error
} Prevention
- Write both directions of every link in the same exporter code path.
- Re-validate after any link edit on either side.
- Avoid manual manifest edits; regenerate instead.
When it happens
Trigger: sessionsById.get(sessionId).resourceIds does not include resource.id, even though resource.sessionIds includes sessionId.
Common situations: A bidirectional link edited on one side only; exporter inconsistency; a partial repair.
Related errors
- Resource references an unknown session: ${sessionId}
- Session references an unknown resource: ${resourceId}
- Session/resource mapping is inconsistent: ${session.id}/${re
- Manifest contains a duplicate path: ${descriptor.path}
- Session id does not match manifest: ${descriptor.path}
AI-assisted analysis of chatboxai/chatbox@81571269ad (2026-08-12).
Data as JSON: /api/errors/329d156b4d5ca43e.
Report an issue: GitHub.