{"record":{"id":"5a8e862692e13950","repo":"unionlabs/union","slug":"no-sui-account-returned-by-wallet","errorCode":null,"errorMessage":"No Sui account returned by wallet","messagePattern":"No Sui account returned by wallet","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"app2/src/lib/wallet/sui/config.svelte.ts","lineNumber":198,"sourceCode":"      return\n    }\n\n    try {\n      const suiWallet = wallet as WalletWithFeatures<SuiWalletFeatures>\n      const connectFeature = suiWallet.features[\"standard:connect\"] as {\n        connect: (input?: { silent?: boolean }) => Promise<{ accounts: readonly unknown[] }>\n      }\n\n      if (!connectFeature) {\n        throw new Error(\"Wallet does not support standard:connect\")\n      }\n\n      const res = await connectFeature.connect({ silent: false })\n      const accounts = res?.accounts ?? wallet.accounts\n      const account = accounts?.[0] as AnyWallet[\"accounts\"][number] | undefined\n\n      if (!account) {\n        throw new Error(\"No Sui account returned by wallet\")\n      }\n\n      this._account = account\n      this._signer = createSigner(suiWallet, account)\n      this.address = account.address\n      this.connectedWallet = walletId\n      this.connectionStatus = \"connected\"\n\n      wallets.suiAddress = S.decodeOption(Ucs05.SuiDisplay)({\n        _tag: \"SuiDisplay\",\n        address: account.address as `0x${string}`,\n      })\n\n      this.saveToStorage()\n      Effect.log(\"wallet.connect\").pipe(annotate, runSync)\n    } catch (e) {\n      Effect.logError(\"wallet.connect\", e).pipe(annotate, runSync)\n","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/unionlabs/union/blob/031785bb6dc6b957c624e62bc64c184409c97d7b/app2/src/lib/wallet/sui/config.svelte.ts#L180-L216","documentation":"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.","triggerScenarios":"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.","commonSituations":"Browser extension asleep on first click; newly installed wallets with no onboarding completed; wallets whose silent:false handling differs from the standard.","solutions":["Open/unlock the wallet and make sure at least one account exists, then retry connect","Check wallet.accounts before connecting and prompt the user to set the wallet up if empty","Treat the error as retryable: catch it, notify the user, and re-run connect after they interact with the wallet"],"exampleFix":"// before\nconst account = accounts?.[0]\nif (!account) {\n  throw new Error(\"No Sui account returned by wallet\")\n}\n\n// after (caller side: pre-check + retry)\nif (!wallet.accounts?.length) {\n  await promptUser(\"Unlock your wallet (and create an account), then try again\")\n  return\n}\ntry {\n  await suiStore.connect(walletId)\n} catch (e) {\n  if (e instanceof Error && /No Sui account/.test(e.message)) {\n    notify(\"Wallet returned no account — unlock it and retry\")\n  }\n}","handlingStrategy":"validation","validationCode":"if (!wallet.accounts?.length) {\n  notify(\"Unlock your wallet (and create an account), then retry.\")\n  return\n}\nawait suiWallets.connect(walletId)","typeGuard":null,"tryCatchPattern":"try {\n  await suiWallets.connect(walletId)\n} catch (e) {\n  if (e instanceof Error && /No Sui account/.test(e.message)) {\n    notify(\"Wallet returned no account — unlock it and try again\")\n    return // user retries after unlocking\n  }\n  throw e\n}","preventionTips":["Check wallet.accounts before initiating connect","Treat empty accounts as retryable: prompt unlock, then re-connect","Verify the wallet finished onboarding (has at least one address) in QA"],"tags":["sui","wallet","accounts"],"backgroundTag":null,"analyzedSha":"031785bb6dc6b957c624e62bc64c184409c97d7b","analyzedAt":"2026-08-16T06:24:09.996Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}