diegosouzapw/OmniRoute · error · Error
Backup file not found
Error message
Backup file not found: ${backupId} What it means
Thrown by restoreBackup() after metadata loads but the actual backup payload file is missing on disk — metadata exists yet the data file was removed or never written. Restoring cannot proceed without the payload.
Solutions
- Re-create the backup; the stored payload is gone
- Clean up orphaned .meta.json entries when listing backups
- Verify the DATA_DIR/backups volume was not wiped or remounted
- Return 404 to the API caller for the missing backup file
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/shared/services/backupService.ts:169 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/cbfb02b7b117f494.
Report an issue: GitHub.
Appendix: source
Thrown at src/shared/services/backupService.ts:169
const dir = getToolBackupDir(toolId);
// Anchor backupId within the tool dir — prevent path traversal via backupId
const backupPath = safePath(toolId, backupId);
const metaPath = backupPath + ".meta.json";
// Read metadata to find original path
let meta;
try {
const raw = await fs.readFile(metaPath, "utf-8");
meta = JSON.parse(raw);
} catch {
throw new Error(`Backup metadata not found: ${backupId}`);
}
// Verify actual backup file exists
try {
await fs.access(backupPath);
} catch {
throw new Error(`Backup file not found: ${backupId}`);
}
// Before restoring, back up the current file (so restore is reversible)
await createBackup(toolId, meta.originalPath);
// Copy backup over the original
const targetDir = path.dirname(meta.originalPath);
await fs.mkdir(targetDir, { recursive: true });
await fs.copyFile(backupPath, meta.originalPath);
return {
restored: true,
backupId,
originalPath: meta.originalPath,
};
}
/**View on GitHub (pinned to a179ffed5b)