coollabsio/coolify · error · Exception
Server not found?!
Error message
Server not found?!
What it means
DatabaseBackupJob resolves the target server through the database: for service databases via database->service->server, for standalone databases via database->destination->server. A null result means the relation chain broke — the destination or service's server was deleted while the ScheduledDatabaseBackup still exists and the job still runs. The job throws instead of silently skipping so the orphaned schedule is visible.
Source
Thrown at app/Jobs/DatabaseBackupJob.php:115
$databasesToBackup = null;
$this->team = Team::find($this->backup->team_id);
if (! $this->team) {
$this->backup->delete();
return;
}
if (data_get($this->backup, 'database_type') === ServiceDatabase::class) {
$this->database = data_get($this->backup, 'database');
$this->server = $this->database->service->server;
$this->s3 = $this->backup->s3;
} else {
$this->database = data_get($this->backup, 'database');
$this->server = $this->database->destination->server;
$this->s3 = $this->backup->s3;
}
if (is_null($this->server)) {
throw new \Exception('Server not found?!');
}
if (is_null($this->database)) {
throw new \Exception('Database not found?!');
}
$this->markStaleExecutionsAsFailed();
BackupCreated::dispatch($this->team->id);
$status = str(data_get($this->database, 'status'));
if (! $status->startsWith('running') && $this->database->id !== 0) {
Log::info('DatabaseBackupJob skipped: database not running', [
'backup_id' => $this->backup->id,
'database_id' => $this->database->id,
'status' => (string) $status,
]);
return;View on GitHub (pinned to 70b9acc424)
Solutions
- Delete the ScheduledDatabaseBackup entries that reference the removed database/server.
- Restore the missing relation (recreate the destination/server record) if the resources still exist.
- If you manage schedules programmatically, delete schedules in the same transaction/unit as their database.
Example fix
// before: schedule outlives its server, job throws 'Server not found?!'
$schedule->delete(); // never called when the server was removed
// after: remove dependent schedules when deleting the server/destination
foreach ($database->scheduledBackups as $schedule) {
$schedule->delete();
}
$database->delete(); Defensive patterns
Strategy: validation
Validate before calling
// Before dispatching or scheduling, verify the relation chain resolves
$database = $backup->database;
$server = $database?->database_type === \App\Models\ServiceDatabase::class
? $database?->service?->server
: $database?->destination?->server;
if (is_null($server)) {
// orphaned schedule: delete it or alert, do not dispatch the job
$backup->delete();
return;
} Type guard
function backupTargetIsResolvable(\App\Models\ScheduledDatabaseBackup $backup): bool
{
$database = $backup->database;
return ! is_null($database) && ! is_null(
$database->database_type === \App\Models\ServiceDatabase::class
? $database->service?->server
: $database->destination?->server
);
} Prevention
- Cascade-delete scheduled backups together with their database/server/destination.
- Run a periodic audit: ScheduledDatabaseBackup rows whose database or server relation is null.
- Fail the schedule visibly on first miss instead of letting it throw on every run.
When it happens
Trigger: A scheduled database backup fires (scheduler dispatches DatabaseBackupJob) after its standalone database's destination or its service's server record was deleted; the backup schedule outlived the resources it points at.
Common situations: Deleting a database/server without first deleting its scheduled backups; partial cleanups during project deletion; stale scheduled tasks re-enabled after server removal.
Related errors
- Database not found?!
- The server is unavailable, so local backup archives cannot b
- The S3 storage used by an existing backup is unavailable.
- Invalid Cron / Human expression
- Wait for the running storage backup and recovery operations
AI-assisted analysis of coollabsio/coolify@70b9acc424 (2026-08-17).
Data as JSON: /api/errors/3db2af608a1746f3.
Report an issue: GitHub.