> ## Documentation Index
> Fetch the complete documentation index at: https://www.qovery.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# BackoffLimitExceeded: Job has reached the specified backoff limit

> A Qovery cron job or lifecycle job fails with BackoffLimitExceeded, often with no error in the logs. Find why the container exited and set the number of restarts and max duration.

A cron job or a lifecycle job is marked as failed, and its events or deployment logs show:

```text theme={null}
BackoffLimitExceeded: Job has reached the specified backoff limit
```

Sometimes the job logs show nothing wrong, or nothing at all.

## What the error means

Qovery runs cron jobs and lifecycle jobs as Kubernetes Jobs. Each time the container of the job exits with a non-zero code, or is killed, Kubernetes counts one failure. When the number of failures goes above the backoff limit, Kubernetes stops retrying and marks the Job as failed with `BackoffLimitExceeded`.

The backoff limit is the **Number of restarts** of the job in Qovery (`max_nb_restart` in the API). Its default is `0`: a single failed run fails the job.

`BackoffLimitExceeded` is only the final status. The real error is the reason the container stopped, so look for that.

## Find why the container stopped

**1. Read the job logs**

Open the job in the Console and go to **Logs**. Look at the last lines before the end of the run: an exception, a stack trace, `Killed`, or an exit message. Logs are kept for a limited time, so check a failed run soon after it happens.

**2. Check the exit code**

If the logs are empty or end abruptly, connect to the cluster (see [Connect to your cluster](https://www.qovery.com/docs/configuration/connect-to-cluster.md)) and inspect the pod of the failed run:

```bash theme={null}
kubectl get pods -n <environment-namespace>
kubectl describe pod <job-pod-name> -n <environment-namespace>
```

Look under `State` for the container that ran, or under `Last State` if it restarted. `Reason: OOMKilled` means the job ran out of memory. `Exit Code: 137` alone is only a hint: it means the container received `SIGKILL`, which also happens when the job is stopped from outside or reaches its maximum duration. Another non-zero exit code comes from your program. A command that cannot be found usually gives `Exit Code: 127` or a `StartError`.

By default only the last failed run of a cron job is kept ([`cronjob.failed_jobs_history_limit`](https://www.qovery.com/docs/configuration/service-advanced-settings#cronjob-failed-jobs-history-limit) is `1`). Raise it to keep more failed runs to inspect.

## Common causes and fixes

### The command is wrong

The job starts, the command fails at once, and nothing useful is printed. This is the most frequent cause when there is no log at all.

In the job **Settings**, Qovery has two fields: **Entrypoint**, which replaces the `ENTRYPOINT` of the image, and **CMD Arguments**, which are passed to it. Putting the full command in **Entrypoint** when the image already has an entrypoint (or the reverse) runs something other than what you expect. Check them against the image:

* Leave **Entrypoint** empty to keep the entrypoint of the image, and put your command in **CMD Arguments** as a JSON array, for example `["npm", "run", "report"]`.
* To run a shell command, set **Entrypoint** to `/bin/sh` and **CMD Arguments** to `["-c", "./run.sh && echo done"]`.

Run the same command locally with `docker run <image> <arguments>` to confirm it works.

### The job ran out of memory

`Reason: OOMKilled` means the container used more memory than its limit. Exit code `137` without that reason can have another cause, as described above. Raise the memory of the job in its **Resources** settings, or process the data in smaller batches.

### The job ran longer than its max duration

When a run takes longer than the **Max Duration** of the job (`max_duration_seconds` in the API), Kubernetes stops it and the run counts as failed. Raise **Max Duration** in the job settings, or make the job do less per run.

### The job fails sometimes and should retry

For jobs that call external systems that can fail for a moment, set **Number of restarts** above `0` so Kubernetes retries a failed run before giving up. Make sure the job is safe to run twice.

### Two runs overlap

If a run is still going when the next schedule starts, [`cronjob.concurrency_policy`](https://www.qovery.com/docs/configuration/service-advanced-settings#cronjob-concurrency-policy) decides what happens. With `Replace`, the running job is stopped. Keep the default `Forbidden` unless your job is built for it.

## Make failures visible

A job that fails without logs is hard to fix the next time. Make your job:

* log a line when it starts and when it ends, with the outcome,
* catch errors at the top level, log them, and exit with a non-zero code,
* report the failure to the tool your team already watches (error tracker, chat, monitoring).

See also [Lifecycle Jobs and Cronjobs execution failed](https://www.qovery.com/docs/getting-started/troubleshoot/overview.md#service-deployment-issues), [Cron jobs](https://www.qovery.com/docs/configuration/cronjob.md) and [Lifecycle jobs](https://www.qovery.com/docs/configuration/lifecycle-job.md).

## Still stuck?

Contact Qovery support from the Console: click the help button at the bottom right, then **Contact Support**. You can also post in your dedicated Slack channel. Include the Console URL of the service, the deployment ID or the time of the error, and the error line from the logs. See [Help and Support](https://www.qovery.com/docs/getting-started/useful-resources/help-and-support.md).


## Related topics

- [Troubleshooting](https://www.qovery.com/docs/getting-started/troubleshoot/overview.md)
- [VpcLimitExceeded: The maximum number of VPCs has been reached](https://www.qovery.com/docs/getting-started/troubleshoot/vpc-limit-exceeded.md)
- [NGINX timeout: increase the 60 second limit](https://www.qovery.com/docs/getting-started/troubleshoot/nginx-timeout.md)
- [Helm upgrade failed: context deadline exceeded](https://www.qovery.com/docs/getting-started/troubleshoot/helm-timed-out.md)
- [Docker Hub](https://www.qovery.com/docs/configuration/integrations/container-registries/docker-hub.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.