Skip to content
CCPEDIAby Unity Nodes
OPENIssue

Wallet picker: unhelpful error when the Wallet Gateway is unreachable or blocked by CORS

#3121by joel-daCreated 04-12-2026

ReferencesCIP-0103

Problem

When a dApp connects to a remote Wallet Gateway through the wallet picker ("Custom Wallet" URL field) and the gateway cannot be reached from the browser, the picker shows a generic message (Failed to fetch or Failed to connect wallet). It gives no hint about what to check.

The most common cause in local and dev setups is CORS. A gateway only accepts the origins in its allowedOrigins (the Splice Docker Compose validator deployment sets just http://portfolio.localhost). When a dApp on another origin, for example DA Registry on DevNet, connects, the browser blocks the response. JavaScript only sees a network-level TypeError, and the real reason is visible only in the browser console. In practice users cannot work out the cause without opening devtools.

Reported while following the DA Registry on DevNet flow with a local validator, where this took a long time to diagnose.

Where the message comes from

  • sdk/dapp-sdk/src/sdk.ts: the connect catch calls formatConnectionErrorMessage(error), then notifyWalletPickerError(message).
  • formatConnectionErrorMessage returns error.message (plus (HTTP nnn) when an HTTP status exists), or Failed to connect wallet if empty.
  • core/wallet-ui-components/src/components/wallet-picker.ts shows that text in its error state.

A CORS failure has no HTTP status and a generic message, so the user sees only that text.

Proposed solution

  1. In formatConnectionErrorMessage, detect a network-level failure when connecting to a remote gateway (a TypeError with no HTTP status, e.g. Failed to fetch) and return an actionable message, for example:

    Can't reach the Wallet Gateway at <url>. Check that the URL is correct and the gateway is running. If it is, make sure the gateway allows requests from this app (<window.location.origin>): see allowedOrigins / CORS in the gateway configuration.

    The browser cannot distinguish CORS from the gateway being down, so the message should list both possibilities.

  2. Include the gateway URL and the app's origin in the message, and link to the relevant docs.

  3. Keep the original error in the details or console, and keep the existing HTTP status handling for responses that do arrive.

  4. Update the "Custom Wallet" tooltip (core/wallet-ui-components/src/components/wallet-picker.ts, currently "Wallet not listed above? Enter its Wallet API. The wallet must support CIP-103.") to say where the URL comes from, for example:

    Using a remote wallet? Enter its Wallet API URL. The wallet must support CIP-103. If it's a Wallet Gateway, you can copy the URL from its menu ("dApp API URL").

    The Wallet Gateway header menu already has a "dApp API URL" item that copies the URL (app-header.ts), so no new gateway UI is needed. Optionally change the input placeholder to the expected shape, https://<gateway-host>/api/v0/dapp.

Acceptance criteria

  • Connecting to an unreachable or CORS-blocked gateway shows a message that names the URL and mentions CORS / allowed origins.
  • HTTP error responses still show the status code.
  • The "Custom Wallet" tooltip says where to find the Wallet Gateway URL.
  • Unit tests cover the network-error branch of formatConnectionErrorMessage.

Related

  • Gateway login form defaults (#3120)