> 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

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

**What happened.** The user went through **sign up** instead of **sign in**. With passkeys, `signUp()` creates a brand-new passkey, and a brand-new passkey produces a brand-new wallet address. The previous account is still there (linked to the original passkey), but the user is now signed in as someone else.

**How to prevent it.** In your UI, keep two distinct entry points:

* A **"Create account"** button that calls `signUp()`, shown to first-time users.
* A **"Sign in"** button that calls `signInWithPasskey()`, shown to returning users.

A single "Continue with passkey" button risks ambiguity, since users don't always know whether they're "new" or "returning". The two-button pattern removes that doubt.

**Recovery.** If the original passkey is still available in the user's password manager, calling `signInWithPasskey()` returns them to the previous account. The accidental new account stays in BaaS but leaves the original untouched.

## `signInWithWallet()` opens two prompts

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

## Sign-in throws `NETWORK_ERROR` or `API_ERROR`

The SDK loads your project's networks lazily on the first passkey sign-in. If that fetch fails, the error surfaces here. See [Error handling](/baas-sdk/resources/error-handling.md) for the full diagnostic table.

## SSR error in Next.js

The SDK is browser-only (it reads `localStorage` and uses WebAuthn). Marking your provider `'use client'` isn't enough, because Client Components are still pre-rendered on the server. See the SSR section of [Use with React](/baas-sdk/integrations/react.md).

## Wallet operations throw `SIGNER_REQUIRED`

When a user signs in with an external wallet (MetaMask, Rainbow, …), every `baas.wallet.*` call and every `.sendTransaction()` on a contract chain must receive `{ signer }` with the same EIP-1193 provider used at sign-in. Otherwise the SDK throws `BaasError('SIGNER_REQUIRED')`.

```ts
const provider = window.ethereum as EIP1193Provider;
await baas.auth.signInWithWallet(provider);

// Later, every wallet op needs that same provider:
await baas.wallet.sendTransaction({ to, value, signer: provider });
await baas.wallet.signMessage(message, { signer: provider });
```

For multi-wallet apps, keep a reference to the provider in a React context or store. See [Wallet operations](/baas-sdk/blockchain/wallet.md) for the full routing rule.

## `sendTransaction` was cancelled

`TRANSACTION_REJECTED` means the user closed the wallet popup. This is a deliberate user action, not a bug. Show a neutral toast like *Transaction cancelled* and let them retry. The same applies to `SIGNATURE_REJECTED` for `signMessage` prompts.

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.baas.sh/baas-sdk/troubleshooting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
