coollabsio/coolify · error · Exception
Database not found?!
Error message
Database not found?!
What it means
DatabaseBackupJob throws when data_get($this->backup, 'database') is null: the ScheduledDatabaseBackup row exists but its related database record (standalone or service database) is gone or its database_type no longer resolves. Note the job returns silently when the whole backup schedule is missing; a present schedule with a missing database is treated as a hard integrity error.
Source
Thrown at app/Jobs/DatabaseBackupJob.php:118
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;
}
if (data_get($this->backup, 'database_type') === ServiceDatabase::class) {
$databaseType = $this->database->databaseType();View on GitHub (pinned to 70b9acc424)
Solutions
- Delete the orphaned ScheduledDatabaseBackup row(s) for the removed database.
- Restore the database record if it was removed by mistake.
- Audit scheduled backups after bulk deletions: ScheduledDatabaseBackup::whereDoesntHave('database')->get().
Example fix
// before: orphaned schedules keep firing and failing $database->delete(); // after: cascade the cleanup $database->scheduledBackups()->delete(); $database->delete();
Defensive patterns
Strategy: validation
Validate before calling
// Confirm the schedule still has its database before the job fires
if (is_null($backup->database)) {
\Illuminate\Support\Facades\Log::warning('Deleting orphaned scheduled backup', ['id' => $backup->id]);
$backup->delete();
return;
}
dispatch(new DatabaseBackupJob($backup)); Type guard
function scheduleHasDatabase(\App\Models\ScheduledDatabaseBackup $backup): bool
{
return ! is_null($backup->database);
} Prevention
- Delete ScheduledDatabaseBackup rows in the same unit of work as the database resource.
- After upgrades or manual DB edits, sweep for schedules with dangling database_type/database ids.
- Prefer model deletion events (observers) over relying on users to clean up schedules manually.
When it happens
Trigger: The database resource was deleted while its ScheduledDatabaseBackup row remained; database_type on the schedule points at a model/class whose record was removed; scheduled task fires after an incomplete resource deletion.
Common situations: Deleting a database via UI/API without cascading to scheduled backups; database_type staleness after upgrades/renames; manual DB surgery that dropped database rows but left schedules.
Related errors
- Server 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/1693cbed3a1139d0.
Report an issue: GitHub.