GitHub Actions "Invalid cron" on schedule trigger
The schedule cron expression does not parse. Actions uses standard five-field POSIX cron and rejects bad syntax.
What this error means
The workflow is rejected or the schedule never fires because the cron string is malformed.
github-actions
The workflow is not valid. .github/workflows/cron.yml (Line: 4): Invalid cron expression '0 0 * *'Common causes
Wrong number of fields
Cron needs exactly five fields: minute, hour, day-of-month, month, day-of-week. Four or six fields fail.
Unsupported syntax
Named macros like @daily are not supported; out-of-range values such as minute 60 are rejected.
How to fix it
Write a valid five-field cron
- Provide all five fields.
- Quote the string to avoid YAML coercion.
- Remember schedules run in UTC.
.github/workflows/cron.yml
on:
schedule:
- cron: '0 0 * * *'How to prevent it
- Validate cron strings with a cron checker before committing.
- Always quote the cron value in YAML.
Related guides
GitHub Actions "Invalid workflow file: error in your yaml syntax"Fix the GitHub Actions "Invalid workflow file: You have an error in your yaml syntax" message caused by tabs,…
GitHub Actions "environment must be a string"Fix the GitHub Actions error where the job environment value is given as a mapping or list instead of a strin…
GitHub Actions "on" section missing or has no triggersFix the GitHub Actions error where the on key is missing or empty, so the workflow has no events to trigger i…