Skip to content
Latchkey

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

  1. Provide all five fields.
  2. Quote the string to avoid YAML coercion.
  3. 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →