Skip to content

A heartbeat job reported a failure

Your job told DownBad it failed. DownBad doesn’t know why: only the job does. This page helps you find the failure in the job, and confirm the heartbeat goes back to Up once it’s fixed.

The heartbeat shows Down, its last ping is marked reported a failure, and DownBad opened an incident with this reason:

Your job reported a failure

It means the job sent a request to its ping URL with /fail on the end. The snippets DownBad gives you send /fail when the job exits with an error, so this is almost always the job’s own failure, not DownBad’s.

It’s the job. DownBad only records a /fail ping when one arrives, and only your job, or someone with the ping URL, can send one. To rule out a stray ping, check the job’s log for a run at the time the incident opened.

Read the log of the run that failed. Where it is depends on where the job runs:

  • Shell / cron: wherever the cron line sends the job’s output. With no redirect, cron mails it to the user that owns the crontab.
  • systemd: run journalctl -u your-job.service -n 50 on the machine, which shows the last 50 lines the service wrote.
  • Kubernetes CronJob: run kubectl get jobs to find the job that ran, then kubectl logs job/<job name>.
  • GitHub Actions: open the run on the repository’s Actions tab. The step that failed is marked with a red cross.
  • WP-Cron: your site’s PHP error log. The snippet rethrows the error after it pings /fail, so it’s logged as usual.

Without a terminal: GitHub Actions shows its logs in the browser. For the others, your hosting provider’s dashboard often shows the logs of scheduled tasks.

The causes below run from most to least likely, so start with the first.

The log shows an error from the job: a backup target that’s full, a database that refused the connection, an expired credential.

  1. Fix the error the log names.

  2. Run the job by hand and check it finishes without one.

The job’s environment is different when it runs on schedule

Section titled “The job’s environment is different when it runs on schedule”

The job works when you run it by hand but fails on schedule. Schedulers run jobs with a short PATH, as another user, in another directory, and without the variables your login shell sets.

  1. Use full paths for every program and file the job uses.

  2. Set the variables the job needs in the scheduler itself: in the crontab, the systemd unit’s Environment= line, the CronJob’s env, or the workflow’s env.

The job’s log shows a run that succeeded at the time the incident opened, yet DownBad recorded /fail. Another script or machine has the ping URL.

  1. Search your scripts, crontabs and workflows for the ping URL.

  2. If you can’t find it, replace the URL: open the heartbeat, press Regenerate, and put the new URL in the job. The old URL stops working at once.

  1. Fix the cause first.

  2. Run the job by hand, or wait for its next scheduled run.

  3. Wait up to 30 seconds. When the run succeeds and pings, the heartbeat’s page shows Up and the incident closes. One successful ping is enough.

If the job pings nothing at all after the fix, the heartbeat goes Late instead: see A heartbeat ping didn’t arrive.

Before you ask for help, collect:

  • the link to the heartbeat or its incident, and the reason it shows, word for word
  • the lines from the job’s log for the run that failed
  • the scheduler’s entry for the job, such as the cron line or the workflow file, with the ping URL taken out

Then send all of it to us through Contact Us.