{"record":{"id":"313750df7d4ca282","repo":"coollabsio/coolify","slug":"invalid-cron-human-expression-for-docker-cleanup","errorCode":null,"errorMessage":"Invalid Cron / Human expression for Docker Cleanup Frequency.","messagePattern":"Invalid Cron / Human expression for Docker Cleanup Frequency\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"app/Livewire/Server/DockerCleanup.php","lineNumber":148,"sourceCode":"    }\n\n    public function manualCleanup()\n    {\n        try {\n            $this->authorize('update', $this->server);\n            DockerCleanupJob::dispatch($this->server, true, $this->deleteUnusedVolumes, $this->deleteUnusedNetworks);\n            $this->dispatch('success', 'Manual cleanup job started. Depending on the amount of data, this might take a while.');\n        } catch (\\Throwable $e) {\n            return handleError($e, $this);\n        }\n    }\n\n    public function submit()\n    {\n        try {\n            if (! validate_cron_expression($this->dockerCleanupFrequency)) {\n                $this->dockerCleanupFrequency = $this->server->settings->getOriginal('docker_cleanup_frequency');\n                throw new \\Exception('Invalid Cron / Human expression for Docker Cleanup Frequency.');\n            }\n            $this->syncData(true);\n            $this->dispatch('success', 'Server updated.');\n        } catch (\\Throwable $e) {\n            return handleError($e, $this);\n        }\n    }\n\n    public function render()\n    {\n        return view('livewire.server.docker-cleanup');\n    }\n}\n","sourceCodeStart":130,"sourceCodeEnd":162,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Livewire/Server/DockerCleanup.php#L130-L162","documentation":"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.","triggerScenarios":"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.","commonSituations":"Copy-pasting cron from other tools; assuming free-form English is accepted because the field mentions 'Human'; stale browser autofill inserting a partial value.","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 * * *\"));'"],"exampleFix":"// before\n$this->dockerCleanupFrequency = 'every day at 3am';\n\n// after\n$this->dockerCleanupFrequency = '0 3 * * *';","handlingStrategy":"validation","validationCode":"if (! validate_cron_expression($this->dockerCleanupFrequency)) {\n    // correct the expression before submit; original setting stays intact\n}","typeGuard":null,"tryCatchPattern":"Keep submit()'s try { ... } catch (\\Throwable $e) { return handleError($e, $this); } and rely on the getOriginal() restore so an invalid submission never partially persists.","preventionTips":["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"],"tags":["cron","docker","cleanup","server","validation"],"backgroundTag":"cron-expression-invalid","analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}