> 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-sdk/troubleshooting.md).

# Troubleshooting

Common BaaS SDK pitfalls and how to resolve them.

The pitfalls you're most likely to hit when integrating the SDK, and how to resolve them.

## A returning user got a new wallet address

The user went through **sign up** instead of **sign in**: a new passkey means a new wallet address. Keep two entry points, **Create account** for first-time users and **Sign in** for everyone else. To get back to the original account, sign in with its email; its passkey is still in the user's password manager.

## The sign-up was interrupted

The network dropped after the passkey prompt. Call `signUpWithSmartWallet()` again with the same email: no new passkey prompt is needed. If the answer is `smart_wallet_already_registered`, the account exists: sign in. A page reload abandons the attempt; if the account may already exist, sign in. Another email in the meantime throws `SIGNUP_ATTEMPT_PENDING`.

## `signInWithWallet()` opens two prompts

That's expected. External wallets ask the user to **connect** (unless the site is already connected), then to **sign** the BaaS verification message. See [External wallet](/baas-sdk/authentication/external-wallet.md).

## A chain operation throws `NETWORK_ERROR` or `API_ERROR`

The SDK could not load your project's networks. Check that the API is up and that `url` is right; `err.status` and `err.body` say what the API refused.

## Every request fails in production but works on `localhost`

Your production origin isn't in your project's allowed origins, so every request from it is refused. Add it under [**Allowed Domains**](/baas-console/api-settings/domain-protection.md) on the **API Settings** page in the BaaS Console. See the [Going to production](/baas-sdk/quickstart.md) note in the Quickstart for the full checklist.

## Sessions keep expiring in local dev

When your app runs on `localhost` and talks to your deployed BaaS API, the session relies on a cross-site cookie. If sessions keep expiring, look at the browser: update it, or allow cookies for your API's domain if a privacy setting or extension blocks them. Nothing to change in the Console.

## SSR error in Next.js

The SDK is browser-only. Load your provider client-side only: see [Server-side rendering](/baas-sdk/integrations/react.md#server-side-rendering).

## Wallet operations throw `SIGNER_REQUIRED`

The user signed in with an external wallet: pass the same provider as `{ signer }` on `sendTransaction`, `signMessage`, `chains.switch` and contract writes.

```ts
await baas.wallet.sendTransaction({ to, value, signer: provider }); // the provider used at sign-in
```

See [Wallet operations](/baas-sdk/blockchain/wallet.md).

## Wallet operations fail after disconnecting the wallet

The SDK ends the session (`SIGNED_OUT`) when the wallet you signed in with disconnects your site or switches accounts. After a reload, re-attach the wallet with [`baas.chains.watchWallet()`](/baas-sdk/blockchain/networks.md#follow-the-wallets-network-after-a-reload); otherwise wallet operations fail with `WALLET_DISCONNECTED` until the user reconnects.

## `sendTransaction` was cancelled

`TRANSACTION_REJECTED` means the user dismissed the wallet popup (a dismissed passkey dialog is `PASSKEY_CEREMONY_NOT_COMPLETED`). Show a neutral toast like *Transaction cancelled* and let them retry. The same applies to `SIGNATURE_REJECTED` for `signMessage` prompts.

## A transaction may or may not have gone through

A timeout does not prove failure. For a passkey send, retain `BaasUserOperationError.operation` and call `baas.wallet.waitForUserOperation()` to resume confirmation without submitting again. For an external wallet, check the transaction hash on the original network. See [When confirmation is uncertain](/baas-sdk/resources/error-handling.md#when-confirmation-is-uncertain).

## A network switch was cancelled or unsupported

Switching an external wallet's network goes through the wallet, so a couple of things can interrupt it. `CHAIN_SWITCH_REJECTED` means the user dismissed the wallet's switch prompt; show a neutral toast and let them retry. `CHAIN_SWITCH_UNSUPPORTED` means the wallet can't switch networks programmatically, so guide the user to switch manually in their wallet. `CHAIN_SWITCH_FAILED` covers any other failure, with the original on `err.cause`.

## `WRONG_NETWORK` on a contract call, send, or balance read

A contract call, a `getBalance`, or a `sendTransaction` runs only on a chain returned by `baas.chains.list()`. For an external-wallet send, the wallet must be on that chain too. Otherwise the SDK throws `WRONG_NETWORK`. Call `baas.chains.switch(chainId)` first, with `{ signer: provider }` for an external-wallet session.

## A contract read returns an array instead of a value

`read()` and `simulate()` resolve to the outputs array: destructure it, and type `T` as a tuple with one slot per output, `read<[string]>()`. See [Read data](/baas-sdk/blockchain/smart-contracts.md#read-data).

## A contract read returns an object instead of a string

The value is formatted: display `formatted`, compute with `raw`, and type the slot `read<[UnitFormattedValue]>()`. See [Read a formatted amount](/baas-sdk/blockchain/smart-units.md#read-a-formatted-amount).

## `SmartUnits()` is refused with `unit_binding_unavailable`

The argument has no unit on the registered ABI version, and a version's units cannot be changed. Pass the raw integer for now, and [declare the unit](/baas-console/contracts/units.md) when you register the next ABI version. In an event filter, an amount whose unit depends on a token id also takes the raw integer. See [When to use raw values](/baas-sdk/blockchain/smart-units.md#when-to-use-raw-values).

## Next

* [Authentication](/baas-sdk/authentication.md) — sign up vs sign in, passkeys vs external wallet.
* [Resources](/baas-sdk/resources.md) — API reference, exported types, and error handling.
