Bad Minute crontab error

By: Shane Harter|Last Updated: Jan 10, 2024

To understand this error, it's useful to know two rules about crontab files:

  1. Every line in your crontab must comply with the cron specification. The only things allowed are blank lines, declared environment variables, comments, and valid cron job schedule expressions.

  2. The first part of a cron job schedule expression is the minute field.

What causes this error

When saving changes, cron will check each line of your crontab. If the line is not blank, and not a variable declaration, and not a comment, then it's expected to start with a valid minute value. If for some reason it doesn't, it will raise a Bad Minute error.

Want alerts if your cron jobs stop working?

Monitor your cron jobs with Cronitor to easily collect output, capture errors and alert you when something goes wrong.

Fixing bad minute errors

This type of error could have many causes. Here are some troubleshooting steps to identify and fix the problem.

  1. The error message will commonly indicate the line number that is problematic. Look for the number after a colon, in this example it's line 11.

    "/tmp/crontab.gLfS38":11: bad minute
    
  2. Check for unexpected line breaks in your crontab file. Sometimes you may inadvertently wrap a long line by adding a line break. Cron requires the full schedule and command on a single line.

    Good:

    0 0 * * * /very/long/example/command/goes/here "with several very long arguments"
    

    Bad:

    0 0 * * *
    /very/long/example/command/goes/here "with several very long arguments"
    
  3. If every line begins with a cron schedule, check that the first field is accurate. Here are the allowed values for the minute field:

    ValueDescription
    0-59Specific Minute
    *Every Minute
    ,List of Minutes, e.g. 1,3,5
    -Range of Minutes, e.g 1-10
    /Minute step value, e.g. 1/5

    Tip: To verify and validate your cron expression use Crontab Guru.

  4. Review any comments in your crontab file and ensure that they all start with a #.

  5. If you have verified that your cron expression is correct, and you have examined each line for spurious characters or extra line breaks, it's possible you are dealing with a non-standard version of Cron. Review your local documentation for further guidance on crontab format. You can do this from your command line by running man 5 crontab