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

# Fail fast when no machine is free

> Get an answer in about 1.5 seconds when no machine of your size is ready, and fall back right away. About machine availability, not setup failures.

> [!NOTE]
>
> This page is about machine availability. To stop when your setup script fails, read [Fail when setup fails](https://docs.boat.dev/setup.md#fail-when-setup-fails).

These four calls put the sandbox on a machine that is already running and waiting:

* Create a sandbox.
* Deploy from a saved snapshot.
* Fork.
* Resume.

They usually get a machine in less than one second. A burst can use all the ready machines of one size. Then the next calls wait while boat builds new machines.

## Use fail fast

If you prefer to fall back to something else instead of waiting, pass `failFast` to any of these calls. The call then answers in about 1.5 seconds with one of two results:

| Result | What it means |
| - | - |
| `202` | The usual answer. The sandbox is on a machine that was ready. |
| `503` `no_ready_machine` | Nothing started. See below. |

When you get `503` `no_ready_machine`:

* boat does not create a sandbox or a fork. A resumed sandbox stays stopped.
* You pay nothing.
* The attempt does not count against your [start limits](https://docs.boat.dev/limits.md).
* Retry, or fall back, immediately.

```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat new --fail-fast --type large
boat new --fail-fast --from ci-runner
boat fork --fail-fast bx_23456789
boat resume --fail-fast bx_23456789
```

```bash curl theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl -sS -X POST "https://boat.dev/api/v1/sandboxes" \
  -H "Authorization: Bearer $BOAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"failFast":true,"from":"ci-runner"}'
# same field on POST /sandboxes/{id}/fork and /sandboxes/{id}/resume
```

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
try {
  const created = await sandbox.create({ failFast: true, from: "ci-runner" });
  // also: sandbox.fork({ sandboxId, failFast: true }), sandbox.resume({ sandboxId, failFast: true })
} catch (error) {
  // 503 no_ready_machine: nothing was started; fall back or retry.
}
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
from boat_sdk.exceptions import ApiException
from boat_sdk.models.create_sandbox_request import CreateSandboxRequest

try:
    created = sandbox.create(create_sandbox_request=CreateSandboxRequest(fail_fast=True, var_from="ci-runner"))
except ApiException as error:
    # 503 no_ready_machine: nothing was started; fall back or retry.
    pass
```


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