> For the complete documentation index, see [llms.txt](https://docs.baas.sh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.baas.sh/baas-cli/troubleshooting.md).

# Troubleshooting

What to do when a command doesn't go through.

Every CLI error starts with `[baas]`, and a failed command exits with a non-zero code, so it's safe to use in CI. Here are the situations you're most likely to hit, and what to do about them.

{% hint style="warning" %}
After a failed **deployment**, check what actually happened before running the command again. A second run can deploy a second copy. See [Before you deploy again](#before-you-deploy-again).
{% endhint %}

## Setup

**`… binary bundled with @baas.sh/cli is missing …`** The installation is incomplete. Run `npm install -g @baas.sh/cli` again.

**`Interactive wizard requires a terminal (TTY).`** The wizard can't ask questions in CI. Pass everything on the command line: `baas deploy <contract> --key <id> --chain <chainId>`, plus `--constructor-args` if the contract needs them.

## Sign-in and projects

| Message                                                                       | What to do                                                                   |
| ----------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| `Not logged in.` / `Session expired.` / `Authentication failed.`              | Run `baas login`.                                                            |
| `No active project.`                                                          | Run `baas use <project-id>`.                                                 |
| `Project "<id>" is not in your session.`                                      | Run `baas projects:list` and pick a project you can access.                  |
| `Permission denied: your account does not have write access to this project.` | Your account is fine, your role isn't. Ask a project owner for write access. |
| `Rate limit reached.`                                                         | Wait a moment and try again.                                                 |

If the CLI can't reach BaaS or a request times out, check your connection and try again. After a deployment command, read the message first: it says whether a retry is safe.

## Picking a contract

| Message                                            | What to do                                                                                                                                                                                                                                      |
| -------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `No deployable contract found …`                   | Check the path and the contract name. Interfaces and abstract contracts can't be deployed.                                                                                                                                                      |
| `Multiple contracts match …`                       | Name the one you want: `src/Tokens.sol:MyToken`. In scripts, give deployed contracts unique names.                                                                                                                                              |
| `Cannot read …` / `Invalid JSON in …`              | Fix the mapping or unit file shown. Explicit `--mapping` / `--unit` paths must exist.                                                                                                                                                           |
| `… Rename this parameter in your Solidity source.` | Rename it. With `baas deploy`, nothing was deployed. With `create` / `script`, the contract is deployed: rebuild, then [register it from the Console](/baas-console/contracts/register-a-contract.md#register-from-the-panel) with the new ABI. |
| `<N> unnamed ABI input(s) auto-named …`            | Just a heads-up. Unnamed inputs are registered as `arg0`, `arg1`, … Name them in Solidity for readable names in the Console.                                                                                                                    |

## Deployment

| Message                                              | What to do                                                                                                                                                                                                                                                      |
| ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| No key is offered, or none is set up on the network  | [Add a key](/baas-cli/deploy.md#add-your-first-key), or retry its setup on that network from the [Vault](/baas-console/vault.md).                                                                                                                               |
| `[REGISTRATION_NETWORK_UNAVAILABLE] Set --rpc-url …` | `deploy create` needs a network to register on. Pass `--rpc-url` or set `eth_rpc_url`. Nothing was deployed.                                                                                                                                                    |
| The deployment is refused                            | BaaS refused the deployment and nothing was sent. Fix what the message says and try again. Unless the CLI adds that the transaction **may still have been received**: then check the key's transactions in the Console's [Vault](/baas-console/vault.md) first. |
| `Deployment not confirmed within 120s …`             | The transaction was sent but hadn't confirmed when the CLI stopped waiting. **Don't run the command again.** Find the transaction by its hash in the Console. Once it's mined, the contract is deployed and you can [register it](#before-you-deploy-again).    |
| `forge create failed …` / `forge script failed …`    | Forge stopped before finishing. Read its output above. Nothing was registered, and a script may already have sent some transactions.                                                                                                                            |

## Registration

| Message                                                              | What to do                                                                                                                                                    |
| -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `BaaS cannot see the deployed bytecode yet. Retrying registration …` | Let it run. The CLI retries for up to about five minutes and never redeploys.                                                                                 |
| `… is already registered with BaaS on chain …`                       | Just a warning: the address is already in your catalog, and the command still succeeds. Check its class and ABI in the Console if you expected something new. |
| `<Contract>: API error 422: …`                                       | BaaS looked at the chain and couldn't match the contract. The hint under the message says why. The contract is deployed.                                      |
| `[REGISTRATION_INCOMPLETE] …`                                        | At least one contract is deployed but not registered. Follow [Before you deploy again](#before-you-deploy-again).                                             |

## Before you deploy again

A failed deployment can leave a contract on-chain and missing from BaaS. Before you rerun anything:

1. Open **Contracts** in the BaaS Console and look for the address. For a `baas deploy` deployment, also check the key's transactions in the Console's [Vault](/baas-console/vault.md). For a Forge deployment, check your broadcast files.
2. If the contract is deployed but missing, [add it from the Console](/baas-console/contracts/register-a-contract.md#register-from-the-panel) with its name, address, network, and ABI. If a mapping or unit was rejected, fix it at the location shown in the error first.
3. Run the deployment again only if nothing was deployed and no transaction is still pending.
