> ## 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.

# invalid_environment_settings

> The environment's runtime or regional settings would fail the deploy pipeline, so createDeployment rejects it up front instead of failing after a build.

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

```json Example theme={"theme":"kanagawa-wave"}
{
  "meta": {
    "requestId": "req_2c9a0jf23l4k567"
  },
  "error": {
    "detail": "Environment \"preview\" cannot be deployed: Port must be between 1 and 65535 (is 0); CPU millicores must be at least 250 (is 0); MemoryMib must be at least 256 (is 0); no schedulable regions are configured. Update the environment's settings before deploying.",
    "status": 400,
    "title": "Bad Request",
    "type": "https://unkey.com/docs/errors/unkey/application/invalid_environment_settings"
  }
}
```

## What Happened?

You called `createDeployment` for an environment whose settings cannot produce a running deployment. Rather than accept the request and let it fail partway through the build, Unkey rejects it immediately and lists every setting that needs fixing. The `detail` message enumerates all failing checks at once so you can fix them in a single pass.

An environment must satisfy the same requirements the deploy pipeline enforces:

* `port` is between 1 and 65535.
* `cpu` is at least 0.25 vCPU (250 millicores).
* `memory` is at least 256 MiB.
* At least one schedulable region is configured.

A freshly created environment starts with default runtime settings and a default region, but this error appears if those were cleared or set to invalid values, or if no schedulable region exists yet.

## How To Fix

1. Read the `detail` message; it names each failing setting and its current value.
2. Call `updateSettings` on the environment to set a valid `port`, `vcpus`, and `memoryMib`.
3. If the message mentions regions, configure at least one schedulable region for the environment.
4. Retry `createDeployment`.

```bash theme={"theme":"kanagawa-wave"}
# Set deployable runtime values, then retry the deployment
curl -X POST https://api.unkey.com/v2/environments.updateSettings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer unkey_YOUR_API_KEY" \
  -d '{
    "project": "acme",
    "app": "payments-api",
    "environment": "preview",
    "port": 8080,
    "vcpus": 0.25,
    "memoryMib": 256
  }'
```

## Common Mistakes

* **Values below the minimum**: `cpu` must be at least 0.25 vCPU, `memory` at least 256 MiB, and `port` within 1-65535; anything lower fails validation.
* **Clearing all regions**: An environment with no schedulable region cannot be scheduled anywhere.
* **Fixing one field at a time**: The `detail` lists every problem at once; resolve them all before retrying instead of round-tripping per field.

## Related Errors

* [err:unkey:application:invalid\_input](./invalid_input) - When request input fails general validation
