Dokploy/dokploy · critical · Error

error instanceof Error ? error.message : "Error restoring my

Error message

error instanceof Error ? error.message : "Error restoring mysql backup"

What it means

restoreMySqlBackup catches any failure in the mysql restore flow (docker exec, gunzip, mysql client import) and rethrows error.message or the generic fallback. The underlying reason appears in console.error and the emit stream right before the throw.

Source

Thrown at packages/server/src/utils/restore/mysql.ts:55

		emit(
			`Restoring database: ${backupInput.databaseName} from ${backupInput.backupFile}`,
		);

		if (serverId) {
			await execAsyncRemote(serverId, command);
		} else {
			await execAsync(command);
		}

		emit("Restore completed successfully!");
	} catch (error) {
		console.error(error);
		emit(
			`Error: ${
				error instanceof Error ? error.message : "Error restoring mysql backup"
			}`,
		);
		throw new Error(
			error instanceof Error ? error.message : "Error restoring mysql backup",
		);
	}
};

View on GitHub (pinned to 546686ea35)

Solutions

  1. Check the emitted message and docker logs for the failing SQL statement
  2. Strip or rewrite DEFINER clauses if users don't exist on target (sed on the dump)
  3. Verify archive integrity and MySQL version compatibility
  4. Increase container memory/disk and retry
Defensive patterns

Strategy: try-catch

Validate before calling

execSync('gunzip -t dump.sql.gz');

Try / catch

try {
  await restoreMySqlBackup(...);
} catch (e) {
  const msg = e instanceof Error ? e.message : String(e);
  if (/DEFINER/.test(msg)) stripDefinersAndRetry();
}

Prevention

When it happens

Trigger: SQL dump incompatible with target MySQL version, DEFINER clauses referencing missing users, corrupt backup file, container/credentials wrong, or disk full during import.

Common situations: Importing a dump with DEFINER=`olduser`@`%` clauses into a fresh container; restoring a truncated gzip; mysql client OOM on huge dumps.

Related errors


AI-assisted analysis of Dokploy/dokploy@546686ea35 (2026-08-27). Data as JSON: /api/errors/89f4e14d810b6d6c. Report an issue: GitHub.