# A deploy or a health check fails

Source: https://openpanel.sh/docs/troubleshooting/deploy-fails

Why a deploy is refused or a rollout fails, what each message means, and what to do.

A deploy can go wrong in two places: OpenPanel refuses it before anything starts, or the rollout on your servers fails. Either way, what ran before keeps running: when a rollout fails, the service goes back to the deployment that ran before it.

## See what happened [#see-what-happened]

```sh
openpanel deployments get "$DEPLOYMENT_ID"
openpanel logs --deployment "$DEPLOYMENT_ID"
```

The first shows the deployment's status and `error`. The second prints its deploy log, what your servers' agents reported, in order:

| Event | What it means |
|---|---|
| `image.pulling`, `image.pulled`, `image.failed` | The server pulls the image, has it, or could not get it. |
| `container.created`, `container.started` | A new container was made and started. |
| `container.healthy`, `container.unhealthy` | It passes, or fails, its health check. |
| `container.exited`, `container.failed` | It stopped, or could not be made or started. |
| `rollout.started`, `rollout.ready`, `rollout.done`, `rollout.failed` | The server's rollout began, every new replica is ready, the old replicas stopped, or a new replica failed and the old ones keep serving. |

In the console, the service's **Deployments** tab shows each deployment's state; click one for its image or commit and its servers. Through the API: `GET /deployments/{id}` and `GET /deployments/{id}/events`. A service's own output, from its running containers, is not offered yet.

## Refused before it starts [#refused-before-it-starts]

The deploy answers with one of these, and no deployment is made:

| Message | What to do |
|---|---|
| "Choose at least one server for this service before deploying." | Give the service a server: tick one under **Servers it may run on** on its **Settings** tab, or `openpanel services update web --server my-server`. A disconnected server does not count. |
| "This service's volume lives on a server that is disconnected. Reconnect it, or remove the volume." | A volume's data stays on its server. Reconnect that server, or remove the volume to start afresh elsewhere. |
| "Turn on the load balancer to run more than one replica of a public service." | Add `--balancer`, or set `--replicas 1`. See [Load balancing](/docs/load-balancing). |
| "The load balancer is for public services. Make the service public, or turn the load balancer off." | Add `--public`, or `--no-balancer`. |
| "A service on a private address runs as one instance." | Set `--replicas 1`. |
| "This service has a volume, so it always runs as one instance. Remove the volume to use replicas or the load balancer." | See [The single-instance rule](/docs/volumes/single-instance). |
| "… refers to `${{…}}`, which is not set." | A [reference](/docs/variables/references) names a variable that does not exist. |
| "A template service deploys once the template catalogue ships." | The service's source is a template, set through the API. Deploy the template from the console's catalogue instead, which makes image services, or give the service an image or a repository. See [Deploy a template](/docs/deploy/templates). |

## Failed during the rollout [#failed-during-the-rollout]

The deployment's status is `failed`, and `error` says why:

| Error | What it means | What to do |
|---|---|---|
| "The image could not be pulled: …" | The image or tag does not exist, the image is private, or the registry did not answer. | Check the name and tag. The image must be public. See [Deploy an image](/docs/deploy/images). |
| "The container could not start: …" | Docker could not make or start the container, for example because of a start command it cannot run. | Read the reason, fix the setting, and deploy again. |
| "The server refused the change: …" | The server's agent turned down the new state. | Read the reason; if it is not clear, [get help](/docs/troubleshooting/get-help). |
| "The container keeps exiting (…)." | The app started and stopped three times: it crashes at start. | Check its variables, its start command and the port it listens on. |
| "Not ready after 15 minutes: it failed its health check." | The app runs, but its [health check](/docs/projects/health-checks) does not pass. | Check that the app listens on the checked port, on all its addresses and not only `127.0.0.1`, and that the path answers with a status from 200 to 399. |
| "Not ready after 15 minutes: its container is exited (exit code 1)." | The container stopped and stayed stopped. | As for a container that keeps exiting. |
| "Not ready after 15 minutes: a server did not start it (is its agent connected?)." | A server never reported the new container. | Check the server's status. A server whose agent is offline cannot run anything new. |
| "Not ready after 15 minutes: it did not become ready." | The containers run but never counted as ready. | Check the health check, and whether the app takes longer than 15 minutes to start. |

A deployment that ends as `cancelled` with "A newer deployment of this service replaced it before it was ready." did not fail: someone deployed again while it rolled out.

## A Git service whose build failed [#a-git-service-whose-build-failed]

The error starts with "The build failed:". See [A build fails](/docs/troubleshooting/build-fails).

## Still stuck [#still-stuck]

[Get help](/docs/troubleshooting/get-help), and send the deployment's id and its error.