coollabsio/coolify · error · RuntimeException
The server is unavailable.
Error message
The server is unavailable.
What it means
While deleting a backup execution on the volume-backups screen, local files still need removal (local_storage_deleted is false and filename is filled) but $this->backup->server() returned null - the backup's server relation cannot be resolved any more. Without a Server model, deleteBackupsLocally() has nowhere to SSH, so the deletion aborts before dropping the execution row.
Source
Thrown at app/Livewire/Project/Shared/Storages/VolumeBackups.php:300
$execution = $this->backup?->executions()->whereKey($executionId)->first();
if (! $execution) {
$this->dispatch('error', 'Backup execution not found.');
return false;
}
if ($execution->status === 'running' || $execution->stop_recovery_pending || $execution->s3_cleanup_pending) {
$this->dispatch('error', 'Wait for the backup and recovery operations to finish before deleting it.');
return false;
}
try {
$server = $this->backup->server();
if (! $execution->local_storage_deleted && filled($execution->filename)) {
if (! $server) {
throw new \RuntimeException('The server is unavailable.');
}
deleteBackupsLocally($execution->filename, $server, throwError: true);
}
if ($this->delete_backup_s3 && $execution->s3_uploaded && ! $execution->s3_storage_deleted) {
if (! $execution->s3) {
throw new \RuntimeException('The S3 storage is unavailable.');
}
deleteBackupsS3($execution->filename, $execution->s3);
}
$execution->delete();
$this->delete_backup_s3 = false;
$this->dispatch('success', 'Backup deleted.');
return true;View on GitHub (pinned to 70b9acc424)
Solutions
- Re-add/restore the server so backup->server() resolves, then retry the delete
- If the files are already gone, mark the execution as locally cleaned (execution->local_storage_deleted = true; execution->save()) and delete again
- Otherwise SSH to the old host, remove the files under the backup path manually, then flip the flag
- Inspect the backup's server() relation and server_id column to confirm which linkage is broken
Example fix
// before
$server = $this->backup->server();
deleteBackupsLocally($execution->filename, $server, throwError: true);
// after
$server = $this->backup->server();
if (! $server) {
$execution->local_storage_deleted = true; // files unreachable
$execution->save();
} else {
deleteBackupsLocally($execution->filename, $server, throwError: true);
} Defensive patterns
Strategy: validation
Validate before calling
if (! $execution->local_storage_deleted && filled($execution->filename) && ! $this->backup->server()) {
// server unreachable: either block deletion or mark local files deleted deliberately
return 'Cannot delete local backup files: server is unavailable.';
} Type guard
/** @param mixed $backup */
function backupHasLiveServer($backup): bool
{
$server = $backup?->server();
return $server instanceof \App\Models\Server;
} Try / catch
Catch Throwable around the delete flow, dispatch('error', 'Failed to delete backup: '.$e->getMessage()), and keep the execution row (do not partially delete state) - the component already leaves deletion to the tail of the try block. Prevention
- Delete backup executions before removing the server that hosts them
- When decommissioning a server, export/clear its backups first
- Flag local_storage_deleted = true when files are known-lost instead of fighting the guard
When it happens
Trigger: The server that hosted the backup files was deleted from Coolify after backups ran; the backup's storage type has a null server() relation; a dangling server_id on the storage after a failed transfer or manual DB edit.
Common situations: Decommissioning a server and then cleaning up its old backup executions; team merges/migrations that leave orphaned storages; executions whose local files were already lost with the host.
Related errors
- The server is unavailable, so local backup archives cannot b
- The S3 storage is unavailable.
- Invalid Cron / Human expression
- Wait for the running storage backup and recovery operations
- The S3 storage used by an existing backup is unavailable.
AI-assisted analysis of coollabsio/coolify@70b9acc424 (2026-08-17).
Data as JSON: /api/errors/c4a52b4928eb459e.
Report an issue: GitHub.