{"record":{"id":"a798b812d7dde934","repo":"coollabsio/coolify","slug":"invalid-cron-human-expression-a798b8","errorCode":null,"errorMessage":"Invalid Cron / Human expression.","messagePattern":"Invalid Cron / Human expression\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"app/Livewire/Project/Shared/ScheduledTask/Show.php","lineNumber":95,"sourceCode":"                'application_uuid' => $application_uuid,\n                'service_uuid' => $service_uuid,\n            ];\n\n            $this->task = $this->resource->scheduled_tasks()->where('uuid', $task_uuid)->firstOrFail();\n            $this->syncData();\n        } catch (\\Exception $e) {\n            return handleError($e);\n        }\n    }\n\n    public function syncData(bool $toModel = false)\n    {\n        if ($toModel) {\n            $this->validate();\n            $isValid = validate_cron_expression($this->frequency);\n            if (! $isValid) {\n                $this->frequency = $this->task->frequency;\n                throw new \\Exception('Invalid Cron / Human expression.');\n            }\n            $this->task->enabled = $this->isEnabled;\n            $this->task->name = str($this->name)->trim()->value();\n            $this->task->command = str($this->command)->trim()->value();\n            $this->task->frequency = str($this->frequency)->trim()->value();\n            $this->task->container = str($this->container)->trim()->value();\n            $this->task->timeout = (int) $this->timeout;\n            $this->task->save();\n        } else {\n            $this->isEnabled = $this->task->enabled;\n            $this->name = $this->task->name;\n            $this->command = $this->task->command;\n            $this->frequency = $this->task->frequency;\n            $this->container = $this->task->container;\n            $this->timeout = $this->task->timeout ?? 300;\n        }\n    }\n","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Livewire/Project/Shared/ScheduledTask/Show.php#L77-L113","documentation":"syncData(toModel: true) on the scheduled-task screen validates the frequency field with validate_cron_expression(), which wraps cron-parser's CronExpression::isValid() plus a lookup in the VALID_CRON_STRINGS human-friendly map (keys like every_minute). When validation fails the field is reverted to the task's stored frequency and the save is aborted with this exception.","triggerScenarios":"Entering a malformed 5-field cron (e.g. '*/2 * * *' with only 4 fields), a 6-field seconds-based cron, a human string not in VALID_CRON_STRINGS (e.g. 'every 5 minutes' or 'every minut'), or a copy-pasted crontab line that includes the username column.","commonSituations":"Copying crontab entries from tutorials (which often include the user field); using Jenkins/Quartz-style 6-field expressions; typos in the human-readable presets; trailing whitespace or smart quotes from pasting.","solutions":["Use a standard 5-field cron expression: minute hour day-of-month month day-of-week, e.g. '*/5 * * * *'","Or use one of Coolify's exact human strings such as every_minute (match the preset keys, no free-form English)","Re-copy the value from the UI frequency picker instead of typing manually","Sanity-check the expression with the same library: php artisan tinker --execute 'var_dump(validate_cron_expression(\"*/5 * * * *\"));'"],"exampleFix":"// before\n$this->frequency = 'every 5 minutes';\n\n// after\n$this->frequency = '*/5 * * * *'; // or an exact preset key like 'every_minute'","handlingStrategy":"validation","validationCode":"if (! validate_cron_expression($frequency)) {\n    return 'Invalid Cron / Human expression.'; // fix input before syncData(true)\n}","typeGuard":null,"tryCatchPattern":"Wrap syncData(true) in try { } catch (\\Exception $e) { return handleError($e, $this); } as the component does; re-display the reverted (stored) frequency so the user sees the canonical value.","preventionTips":["Restrict input to the UI frequency picker or validated presets","Remember the accepted format: 5-field cron or exact VALID_CRON_STRINGS keys","Trim and reject 6-field/username-carrying crontab lines before submit"],"tags":["cron","scheduled-task","validation"],"backgroundTag":"cron-expression-invalid","analyzedSha":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}