> ## Documentation Index
> Fetch the complete documentation index at: https://unkey-chronark-cli.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# deployment_not_ready

> The target deployment has not reached ready status, or it is shutting down and can no longer serve traffic, so it cannot be promoted or rolled back to.

<Danger>`err:unkey:application:deployment_not_ready`</Danger>

```json Example theme={"theme":"kanagawa-wave"}
{
  "meta": {
    "requestId": "req_2c9a0jf23l4k567"
  },
  "error": {
    "detail": "The deployment is not ready.",
    "status": 412,
    "title": "Precondition Failed",
    "type": "https://unkey.com/docs/errors/unkey/application/deployment_not_ready"
  }
}
```

## What Happened?

You tried to promote or roll back to a deployment that cannot serve traffic. A deployment is only eligible once it has finished building and reached `ready` status. This error is returned in two cases:

* The deployment never reached `ready` status (it is still building, or it failed, was skipped, or was superseded).
* The deployment reached `ready` but is now shutting down after being demoted, so routing it live again would send traffic to a deployment that is going away.

`getDeployment` reports the current `status`, and `availableActions` omits `promote` and `rollback` while a deployment is in either state.

## How To Fix

1. Fetch the deployment with `getDeployment` and check its `status`.
2. If it is still building, wait for `ready` and retry.
3. If it `failed`, inspect the `error` object for the reason, fix the underlying issue, and create a new deployment.
4. If `status` is `ready` but `promote` or `rollback` is not listed in `availableActions`, the deployment is shutting down; pick a different one.

```bash theme={"theme":"kanagawa-wave"}
# Confirm the deployment is ready before promoting
curl -X POST https://api.unkey.com/v2/deployments.getDeployment \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer unkey_YOUR_API_KEY" \
  -d '{ "deploymentId": "d_1234abcd" }'
```

## Common Mistakes

* **Promoting before the build finishes**: Acting on a deployment that is still building instead of waiting for `ready`.
* **Ignoring `availableActions`**: Calling `promote` or `rollback` when the action is not listed for the current state.
* **Reusing a demoted deployment**: Routing live traffic back onto a deployment that is already shutting down.

## Related Errors

* [err:unkey:application:deployment\_is\_current](./deployment_is_current) - When the target is already the current deployment
* [err:unkey:application:deployment\_no\_current](./deployment_no_current) - When the app has no current deployment to act over
* [err:unkey:application:deployment\_not\_production](./deployment_not_production) - When the action requires a production deployment
