> For the complete documentation index, see [llms.txt](https://www.lightward.guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.lightward.guide/technical/fly/deploys/recovering-from-deploy-failures.md).

# Recovering from deploy failures

{% hint style="info" %}
In this section, "retry" means "use GitHub Action's retry button on the failed run".
{% endhint %}

## Build failures

You *might* need to destroy the Fly builder app. It'll get auto-created again when you retry, which is what you should do after destroying the builder app.

## Docker failures

Just retry. It's fine. :)

## Release command failures

Just retry. It's fine. :)

## Machine update failures

Start by surveying the scene, to see how many machines are on the new image vs the old one, or in `replacing` vs `failed` vs `created` status.

```
$ fly m list -a $FLY_APP_NAME
```

### Total machine update failure, i.e. the release command succeeded but no Machines were updated at all

If you're here, the app is probably online but no longer processing background jobs (because all the Sidekiq processes were instructed to enter quiet mode during [the release command](/technical/fly/deploys.md#release-commands)).

Handle this by rebooting one of the worker\_autoscale machines. That should be enough to start bringing machines back online.

```
$ fly m list -a $FLY_APP_NAME | grep worker_autoscale
$ fly m restart MACHINE_ID
```

Once you've verified that the app is doing work again, wait for it to catch up on the run backlog, and then retry the deploy.

### **A minority of machines were successfully updated**

Manually redo the deploy.

Do this using a [CLI deploy](/technical/fly/deploys.md#cli-deploys), using the Docker image URI from the build step.

### A majority of machines were successfully updated

Manually update the rest of the machines.

Start by examining `fly m list -a $FLY_APP_NAME`, and build a list of machine IDs that are stuck on the old image.

For each one, do something like this:

```sh
fly m update 328756e9f52758 \
  --env RELEASE_LABEL=v62-3-ga38cb23a \
  --image registry.fly.io/$FLY_APP_NAME:locksmith-api.v62-3-ga38cb23a
```

### Sometimes a machine will get stuck and you'll need to outright destroy it

`fly m destroy MACHINE_ID`

Add `--force` if the machine is stubborn and won’t stop.

and then use `fly scale count` to scale back up to the desired machine count. Search fly scale count in the internal slack and you'll see example usage.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://www.lightward.guide/technical/fly/deploys/recovering-from-deploy-failures.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
