{"record":{"id":"e54273d7902d1de6","repo":"chatboxai/chatbox","slug":"backup-contains-an-entry-not-listed-in-manifest","errorCode":null,"errorMessage":"Backup contains an entry not listed in manifest: ${path}","messagePattern":"Backup contains an entry not listed in manifest: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/renderer/packages/backup/import-backup.ts","lineNumber":100,"sourceCode":"    manifest.data.settings,\n    manifest.data.copilots,\n    manifest.data.sessionSettings,\n    ...manifest.sessions,\n    ...manifest.resources,\n  ].filter((entry): entry is NonNullable<typeof entry> => Boolean(entry))\n  const expectedPaths = new Set<string>([BACKUP_MANIFEST_PATH])\n  for (const descriptor of descriptors) {\n    if (expectedPaths.has(descriptor.path)) throw new Error(`Manifest contains a duplicate path: ${descriptor.path}`)\n    expectedPaths.add(descriptor.path)\n    const staged = stagedEntries.get(descriptor.path)\n    if (!staged) throw new Error(`Backup entry is missing: ${descriptor.path}`)\n    if (staged.size !== descriptor.size) throw new Error(`Backup entry size mismatch: ${descriptor.path}`)\n    if (staged.checksum.value !== descriptor.checksum.value) {\n      throw new Error(`Backup entry checksum mismatch: ${descriptor.path}`)\n    }\n  }\n  for (const path of stagedEntries.keys()) {\n    if (!expectedPaths.has(path)) throw new Error(`Backup contains an entry not listed in manifest: ${path}`)\n  }\n  if (expectedPaths.size !== stagedEntries.size) throw new Error('Backup manifest entry list is incomplete')\n  validateBackupManifestGraph(manifest)\n}\n\nasync function readStagedResource(storage: BackupStorage, plan: Pick<ResourceWritePlan, 'resource' | 'tempKey'>) {\n  const base64 = await storage.getBlob(plan.tempKey)\n  if (base64 === null) throw new Error(`Staged resource is missing: ${plan.resource.path}`)\n  return decodeStoredBlob(base64ToBytes(base64), plan.resource.encoding, plan.resource.mimeType)\n}\n\nasync function findAvailableCollisionKey(storage: BackupStorage, originalKey: string, reserved: Set<string>) {\n  for (let attempt = 0; attempt < 100; attempt++) {\n    let candidatePrefix = 'resource:imported'\n    for (const prefix of ['picture:', 'file:', 'link:', 'parseFile-', 'parseUrl-']) {\n      if (originalKey.startsWith(prefix)) {\n        candidatePrefix = `${prefix}imported`\n        break","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/chatboxai/chatbox/blob/81571269addb6bafb589a920b2883f1e1e084fd1/src/renderer/packages/backup/import-backup.ts#L82-L118","documentation":"Thrown when the zip contains an entry whose path is not listed in the manifest. The manifest must enumerate every archived file; an unlisted entry is treated as unexpected content (possible tampering or unrecognized future-format files). Propagates after rollback.","triggerScenarios":"stagedEntries has a path that is neither BACKUP_MANIFEST_PATH nor any descriptor.path from settings/copilots/sessionSettings/sessions/resources.","commonSituations":"Someone dropped an extra file into the zip; a backup from a newer format version the importer does not recognize; a manifest that was trimmed but the zip was not.","solutions":["Use a backup produced by a compatible app version.","If you added files to the zip, remove them or regenerate a consistent archive.","Update the manifest to list every archived file (only if you control the format)."],"exampleFix":"// before: zip carries __MACOSX metadata not in the manifest\nawait importBackupArchive(file, options)\n// after: list entries and confirm each is manifest-listed before import\nconst extra = zipEntryPaths.filter((p) => !expectedPaths.has(p))\nif (extra.length) throw new Error('Unexpected entries: ' + extra.join(', '))","handlingStrategy":"validation","validationCode":"// Compare archive entries against manifest-declared paths before importing.\nconst extra = zipEntryPaths.filter((p) => !expectedPaths.has(p))\nif (extra.length) throw new Error('Archive contains unmanifested entries: ' + extra.join(', '))","typeGuard":null,"tryCatchPattern":"try {\n  await importBackupArchive(file, options)\n} catch (error) {\n  if (error instanceof Error && error.message.startsWith('Backup contains an entry not listed in manifest')) {\n    // Re-zip excluding foreign files (e.g. __MACOSX, .DS_Store).\n    throw new Error('Archive has unexpected entries', { cause: error })\n  }\n  throw error\n}","preventionTips":["Produce backups only with the app's exporter, which lists every entry in the manifest.","When zipping manually, exclude OS metadata directories.","Keep the importer version in sync with the backup format version."],"tags":["backup","import","manifest","unexpected-entry","integrity"],"backgroundTag":null,"analyzedSha":"81571269addb6bafb589a920b2883f1e1e084fd1","analyzedAt":"2026-08-12T21:51:44.981Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}