coollabsio/coolify · error · Exception
Invalid Cron / Human expression for Docker Cleanup Frequency
Error message
Invalid Cron / Human expression for Docker Cleanup Frequency.
What it means
The Docker cleanup screen's submit() validates dockerCleanupFrequency with validate_cron_expression() (cron-parser isValid() plus the VALID_CRON_STRINGS presets). On failure the property is restored from server->settings->getOriginal('docker_cleanup_frequency') and the exception is routed through handleError, so the stored schedule is untouched.
Source
Thrown at app/Livewire/Server/DockerCleanup.php:148
}
public function manualCleanup()
{
try {
$this->authorize('update', $this->server);
DockerCleanupJob::dispatch($this->server, true, $this->deleteUnusedVolumes, $this->deleteUnusedNetworks);
$this->dispatch('success', 'Manual cleanup job started. Depending on the amount of data, this might take a while.');
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function submit()
{
try {
if (! validate_cron_expression($this->dockerCleanupFrequency)) {
$this->dockerCleanupFrequency = $this->server->settings->getOriginal('docker_cleanup_frequency');
throw new \Exception('Invalid Cron / Human expression for Docker Cleanup Frequency.');
}
$this->syncData(true);
$this->dispatch('success', 'Server updated.');
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function render()
{
return view('livewire.server.docker-cleanup');
}
}
View on GitHub (pinned to 70b9acc424)
Solutions
- Use a valid 5-field cron like '0 3 * * *' (daily 03:00)
- Or use an exact VALID_CRON_STRINGS preset key - not free-form English
- Clear autofill/whitespace and retype the expression
- Validate in tinker first: php artisan tinker --execute 'var_dump(validate_cron_expression("0 3 * * *"));'
Example fix
// before $this->dockerCleanupFrequency = 'every day at 3am'; // after $this->dockerCleanupFrequency = '0 3 * * *';
Defensive patterns
Strategy: validation
Validate before calling
if (! validate_cron_expression($this->dockerCleanupFrequency)) {
// correct the expression before submit; original setting stays intact
} Try / catch
Keep submit()'s try { ... } catch (\Throwable $e) { return handleError($e, $this); } and rely on the getOriginal() restore so an invalid submission never partially persists. Prevention
- Use 5-field cron or exact preset keys only
- Validate via tinker before saving to shared production servers
- Re-enter the schedule after failures - the field reverted to the stored value
When it happens
Trigger: Saving an invalid expression such as '0 0 * *' (4 fields), 'every hour' (not a preset key - the preset is phrased differently), 6-field cron with seconds, or a crontab line including the username column.
Common situations: Copy-pasting cron from other tools; assuming free-form English is accepted because the field mentions 'Human'; stale browser autofill inserting a partial value.
Related errors
- Invalid Cron / Human expression for Disk Usage Check Frequen
- Invalid Cron / Human expression
- Invalid dockerfile_target_build: contains forbidden characte
- Invalid {$fieldName}: contains forbidden characters.
- Invalid {$fieldName}: path traversal detected.
AI-assisted analysis of coollabsio/coolify@70b9acc424 (2026-08-17).
Data as JSON: /api/errors/313750df7d4ca282.
Report an issue: GitHub.