Dokploy/dokploy · critical · Error
Database file not found after extraction
Error message
Database file not found after extraction
What it means
During web-server backup restore, after extracting the archive the code expects tempDir/database.sql to exist; if `ls` output doesn't contain it, the backup is considered incomplete. This guards before dropping/recreating the Dokploy Postgres database.
Source
Thrown at packages/server/src/utils/restore/web-server.ts:86
// Now handle database restore
emit("Starting database restore...");
// Check if database.sql.gz exists and decompress it
const { stdout: hasGzFile } = await execAsync(
`ls ${tempDir}/database.sql.gz || true`,
);
if (hasGzFile.includes("database.sql.gz")) {
emit("Found compressed database file, decompressing...");
await execAsync(`cd ${tempDir} && gunzip database.sql.gz`);
}
// Verify database file exists
const { stdout: hasSqlFile } = await execAsync(
`ls ${tempDir}/database.sql || true`,
);
if (!hasSqlFile.includes("database.sql")) {
throw new Error("Database file not found after extraction");
}
const { stdout: postgresContainer } = await execAsync(
`docker ps --filter "name=dokploy-postgres" --filter "status=running" -q | head -n 1`,
);
if (!postgresContainer) {
throw new Error("Dokploy Postgres container not found");
}
const postgresContainerId = postgresContainer.trim();
// Drop and recreate database
emit("Disconnecting all users from database...");
await execAsync(
`docker exec ${postgresContainerId} psql -U dokploy postgres -c "SELECT pg_terminate_backend(pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = 'dokploy' AND pid <> pg_backend_pid();"`,
);
View on GitHub (pinned to 546686ea35)
Solutions
- Open the backup archive and confirm database.sql exists at the expected path
- Re-create the backup ensuring the database dump step succeeded
- Match the Dokploy version that produced the backup
- Check extraction logs for errors before this check
Defensive patterns
Strategy: validation
Validate before calling
const list = execSync(`tar -tzf ${backupFile}`).toString();
if (!list.includes('database.sql')) {
throw new Error('Backup is missing the database dump — do not restore');
} Prevention
- Inspect archive contents before initiating a restore
- Never restore archives from unknown/partial sources
When it happens
Trigger: Backup archive lacks database.sql (config-only backup), extraction failed silently, archive is corrupt, or the file has a different name/path layout than expected.
Common situations: Uploading an old or partial backup file; a backup taken while the DB dump step failed; archive created by a different Dokploy version with a different layout.
Related errors
- error instanceof Error ? error.message : "Error restoring mo
- error instanceof Error ? error.message : "Error restoring ma
- error instanceof Error ? error.message : "Error restoring mo
- error instanceof Error ? error.message : "Error restoring my
- Dokploy Postgres container not found
AI-assisted analysis of Dokploy/dokploy@546686ea35 (2026-08-27).
Data as JSON: /api/errors/06d4773768f083a6.
Report an issue: GitHub.