---
title: Troubleshoot the CLI
description: Recover from disconnected accounts, invalid stages, stale checkout settings, and failed readiness checks.
owner: engineering
sourceFiles:
  - apps/cli/src/options.ts
  - apps/cli/src/wizard.ts
  - apps/cli/src/workflow.ts
  - apps/cli/src/environments.ts
  - apps/cli/src/setup-error.ts
---

## A provider is not connected

Reconnect it in the intended [Alchemy profile](/operations/credentials#alchemy-profiles), then run:

```sh
bun run workbench doctor --stage dev-yourname --profile team
```

A `cf` or `pscale` login does not connect Alchemy. Doctor checks credential configuration; `plan` verifies remote permissions.

## Configuration validation failed

```sh
bun run env:check
```

For profile diagnostics, run from `infra`:

```sh
bunx --no-install alchemy profile show --profile team --no-input
```

Captured failures are suppressed because they may contain secrets. Inspect provider output locally; do not paste it into tickets.

## A stage is rejected

Use a personal `dev-*` stage and pass `--stage` only to `doctor`, `plan`, or `provision`. See [exact limits](/reference/cli#stages-and-profiles). Local development reads `WORKBENCH_DEV_STAGE` instead.

## Provisioning needs a terminal

Both input and output must be terminals. `--plain` cannot bypass the typed confirmation. Use `plan` for unattended review.

## A new worktree has no API connection

For `bun run dev`, the saved environment is reused across linked worktrees; no per-worktree refresh is needed. With no saved selection, choose an existing environment in the picker or run `bun run onboard` once.

For frontend-only `bun run dev:web`, run setup in that worktree and choose **Refresh API connection for this checkout**, then restart the dev server. See [worktree setup](/get-started/environment#new-worktree).

## The remembered environment is unavailable

Check the stage, profile, account access, saved outputs, and API health. An unavailable state store does not prove resources are missing. Review infrastructure updates explicitly; setup never creates replacements automatically.

A corrupt or unsupported `workbench-onboarding.json` stops setup. Preserve and inspect it before repairing: linked worktrees share its selections.

## Deployment succeeded but the local target is stale

Saving settings can fail after deployment succeeds. Verify and refresh or relink the existing environment. Failed or cancelled deployment leaves the previous target unchanged.

## Optional injection cannot start

Install/configure `op` and verify access to the reference file's development items. Follow [1Password setup](/operations/credentials#optional-1password-injection); never paste resolved secrets into docs.
