{"record":{"id":"924429664561c41d","repo":"Dokploy/dokploy","slug":"error-instanceof-error-error-message-error-re","errorCode":null,"errorMessage":"error instanceof Error ? error.message : \"Error restoring mongo backup\"","messagePattern":"error instanceof Error \\? error\\.message : \"Error restoring mongo backup\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/server/src/utils/restore/compose.ts","lineNumber":99,"sourceCode":"\t\temit(\n\t\t\t`Restoring database: ${backupInput.databaseName} from ${backupInput.backupFile}`,\n\t\t);\n\n\t\tif (serverId) {\n\t\t\tawait execAsyncRemote(serverId, restoreCommand);\n\t\t} else {\n\t\t\tawait execAsync(restoreCommand);\n\t\t}\n\n\t\temit(\"Restore completed successfully!\");\n\t} catch (error) {\n\t\tconsole.error(error);\n\t\temit(\n\t\t\t`Error: ${\n\t\t\t\terror instanceof Error ? error.message : \"Error restoring mongo backup\"\n\t\t\t}`,\n\t\t);\n\t\tthrow new Error(\n\t\t\terror instanceof Error ? error.message : \"Error restoring mongo backup\",\n\t\t);\n\t}\n};\n","sourceCodeStart":81,"sourceCodeEnd":104,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/packages/server/src/utils/restore/compose.ts#L81-L104","documentation":"restoreComposeBackup wraps its whole restore flow in try/catch and rethrows either the caught error's message or the generic fallback 'Error restoring mongo backup' (copy-paste artifact: this is the compose restore, not mongo). Any failure in docker compose commands, volume handling, or file ops surfaces here.","triggerScenarios":"Docker CLI errors during compose up, missing backup archive entries, permission issues on volume paths, or a non-Error rejection (e.g. string throw) which triggers the fallback message.","commonSituations":"Restoring a compose backup with mismatched volume definitions, insufficient disk space, or a partially uploaded backup file.","solutions":["Read console.error output emitted just before the throw to find the real underlying error","Verify the backup archive is complete and volumes/paths match the original compose stack","Ensure docker and compose plugin are available and the user has permissions","Free disk space and retry the restore"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!existsSync(backupPath)) throw new Error('Backup file missing before restore');","typeGuard":null,"tryCatchPattern":"try {\n  await restoreComposeBackup(...);\n} catch (e) {\n  emit(`Restore failed: ${e instanceof Error ? e.message : String(e)}`);\n  // keep partial state for manual cleanup\n}","preventionTips":["Test restores on a staging stack regularly","Verify archive integrity before restoring","Keep docker/compose versions consistent between backup and restore hosts"],"tags":["backup","restore","docker-compose","mongo"],"backgroundTag":"backup-restore-failed","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}