unionlabs/union · error · Error

No Sui account returned by wallet

Error message

No Sui account returned by wallet

What it means

After a successful standard:connect call, the Sui wallet returned zero accounts: both res.accounts and the fallback wallet.accounts are empty, so accounts[0] is undefined and the guard throws. This is almost always a wallet-side state issue (locked, no account created) rather than an API misuse.

Source

Thrown at app2/src/lib/wallet/sui/config.svelte.ts:198

      return
    }

    try {
      const suiWallet = wallet as WalletWithFeatures<SuiWalletFeatures>
      const connectFeature = suiWallet.features["standard:connect"] as {
        connect: (input?: { silent?: boolean }) => Promise<{ accounts: readonly unknown[] }>
      }

      if (!connectFeature) {
        throw new Error("Wallet does not support standard:connect")
      }

      const res = await connectFeature.connect({ silent: false })
      const accounts = res?.accounts ?? wallet.accounts
      const account = accounts?.[0] as AnyWallet["accounts"][number] | undefined

      if (!account) {
        throw new Error("No Sui account returned by wallet")
      }

      this._account = account
      this._signer = createSigner(suiWallet, account)
      this.address = account.address
      this.connectedWallet = walletId
      this.connectionStatus = "connected"

      wallets.suiAddress = S.decodeOption(Ucs05.SuiDisplay)({
        _tag: "SuiDisplay",
        address: account.address as `0x${string}`,
      })

      this.saveToStorage()
      Effect.log("wallet.connect").pipe(annotate, runSync)
    } catch (e) {
      Effect.logError("wallet.connect", e).pipe(annotate, runSync)

View on GitHub (pinned to 031785bb6d)

Solutions

  1. Open/unlock the wallet and make sure at least one account exists, then retry connect
  2. Check wallet.accounts before connecting and prompt the user to set the wallet up if empty
  3. Treat the error as retryable: catch it, notify the user, and re-run connect after they interact with the wallet

Example fix

// before
const account = accounts?.[0]
if (!account) {
  throw new Error("No Sui account returned by wallet")
}

// after (caller side: pre-check + retry)
if (!wallet.accounts?.length) {
  await promptUser("Unlock your wallet (and create an account), then try again")
  return
}
try {
  await suiStore.connect(walletId)
} catch (e) {
  if (e instanceof Error && /No Sui account/.test(e.message)) {
    notify("Wallet returned no account — unlock it and retry")
  }
}
Defensive patterns

Strategy: validation

Validate before calling

if (!wallet.accounts?.length) {
  notify("Unlock your wallet (and create an account), then retry.")
  return
}
await suiWallets.connect(walletId)

Try / catch

try {
  await suiWallets.connect(walletId)
} catch (e) {
  if (e instanceof Error && /No Sui account/.test(e.message)) {
    notify("Wallet returned no account — unlock it and try again")
    return // user retries after unlocking
  }
  throw e
}

Prevention

When it happens

Trigger: Wallet is locked and resolves connect with no accounts; fresh wallet installation with no accounts created; user dismisses the connect prompt and the wallet resolves with an empty array instead of rejecting.

Common situations: Browser extension asleep on first click; newly installed wallets with no onboarding completed; wallets whose silent:false handling differs from the standard.

Related errors


AI-assisted analysis of unionlabs/union@031785bb6d (2026-08-16). Data as JSON: /api/errors/5a8e862692e13950. Report an issue: GitHub.