{"record":{"id":"f4200cdb66491d9c","repo":"moghtech/komodo","slug":"finished-backing-up-database-with-errors","errorCode":null,"errorMessage":"Finished backing up database with errors 🚨","messagePattern":"Finished backing up database with errors 🚨","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"critical","filePath":"lib/database/src/utils/backup.rs","lineNumber":138,"sourceCode":"            has_error.store(true, atomic::Ordering::Relaxed);\n          }\n        }\n      })\n    })\n    .collect::<FuturesUnordered<_>>();\n\n  loop {\n    match handles.next().await {\n      Some(Ok(())) => {}\n      Some(Err(e)) => {\n        error!(\"{e:#}\");\n      }\n      None => break,\n    }\n  }\n\n  if has_error.load(atomic::Ordering::Relaxed) {\n    Err(anyhow!(\"Finished backing up database with errors 🚨\"))\n  } else {\n    info!(\"Finished backing up database ✅\");\n    Ok(())\n  }\n}\n","sourceCodeStart":120,"sourceCodeEnd":144,"githubUrl":"https://github.com/moghtech/komodo/blob/780ac68b992094a9fccd5fffb760e0c84fd3c3d1/lib/database/src/utils/backup.rs#L120-L144","documentation":"backup streams the database to a backup while recording per-item failures in an atomic has_error flag. At the end, if any error occurred during the run, it returns this error instead of logging success — the backup file may be produced but is incomplete or partially failed.","triggerScenarios":"Any individual document/collection failing to serialize or write during backup (disk full, permission denied on backup path, unreadable DB entries) sets has_error; backup() then finishes with this error.","commonSituations":"Backup directory without write permission, disk quota/full disk, corrupted database entries, race with concurrent writes during backup.","solutions":["Scan preceding logs for the per-item errors logged during the backup — they name the actual cause","Check disk space and write permissions on the backup destination directory","Fix or exclude the corrupted/failing records reported, then rerun the backup","Alert/monitor: a backup ending with this error must not be treated as a good backup"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let meta = fs::metadata(&backup_dir).context(\"backup dir\")?;\nanyhow::ensure!(meta.permissions().mode() & 0o200 != 0, \"backup dir not writable\");\nanyhow::ensure!(fs2::free_space(&backup_dir)? > required_bytes, \"insufficient disk space for backup\");","typeGuard":null,"tryCatchPattern":"match backup(config).await {\n    Ok(()) => info!(\"backup OK\"),\n    Err(e) if e.to_string().contains(\"with errors\") => {\n        error!(\"backup incomplete — do not ship this file; inspect prior per-item errors\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Pre-check disk space and write permissions on the backup path","Treat this error as backup failure — never consume a backup that returned it","Monitor the detailed per-item errors logged during the backup run"],"tags":["database","backup","partial-failure"],"backgroundTag":"db-backup-failed","analyzedSha":"780ac68b992094a9fccd5fffb760e0c84fd3c3d1","analyzedAt":"2026-09-08T10:02:44.861Z","contentChangedAt":"2026-09-08T10:02:44.861Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}