PollarPollar
SDK Reference

Error Codes

All errors from the Pollar SDK and Server follow a consistent structure.


Error structure

SDK (PollarError):

{
  code: 'INSUFFICIENT_FUNDING_BALANCE',
  message: 'The funding wallet does not have enough XLM to activate this wallet.',
  status: 402,
  meta?: { ... }
}

Server (REST API):

{
  "error": {
    "code": "INSUFFICIENT_FUNDING_BALANCE",
    "message": "The funding wallet does not have enough XLM to activate this wallet.",
    "status": 402
  }
}

Authentication

CodeStatusDescriptionResolution
UNAUTHORIZED401Missing or invalid API keyCheck that you are passing the correct publishable or secret key
KEY_NETWORK_MISMATCH401Key prefix does not match the target networkUse pub_testnet_ / sec_testnet_ for testnet and pub_mainnet_ / sec_mainnet_ for mainnet
KEY_REVOKED401API key has been revokedGenerate a new key from Dashboard → API Keys
SESSION_EXPIRED401User session has expiredCall login() again

Wallet

CodeStatusDescriptionResolution
WALLET_NOT_FOUND404Wallet ID does not exist in your appVerify the walletId
WALLET_ALREADY_ACTIVE409Wallet is already activeSafe to ignore — idempotent activation
WALLET_PENDING422Wallet exists but is not yet fundedActivate the wallet before attempting to transact
WALLET_CREATION_FAILED500Failed to create wallet on StellarRetry — transient Stellar network issue

Funding & Sponsorship

CodeStatusDescriptionResolution
INSUFFICIENT_FUNDING_BALANCE402Funding wallet does not have enough XLM to cover the activation reserveTop up your funding wallet from Dashboard → Configuration → App Wallets
INSUFFICIENT_GAS_BALANCE402Gas wallet does not have enough XLM to pay transaction feesTop up your gas wallet from Dashboard → Sponsorship Budget
INSUFFICIENT_DISTRIBUTION_BALANCE402Distribution wallet does not have enough of the requested assetTop up your distribution wallet from Dashboard → Distribution Wallet
FUND_NOT_ENABLED_ON_MAINNET403fund() was called on mainnet without explicit enablementEnable from Dashboard → Distribution Wallet → Allow fund() on mainnet
FUND_ASSET_NOT_CONFIGURED422The requested asset is not configured for distributionAdd the asset from Dashboard → Distribution Wallet → Configured assets
FUND_RATE_LIMIT_EXCEEDED429User has exceeded the configured funding rate limitConfigured in Dashboard → Distribution Wallet → Rate limits

Payments

CodeStatusDescriptionResolution
INVALID_DESTINATION400Recipient G-address is invalid or does not exist on StellarVerify the destination address
INVALID_AMOUNT400Amount is not a valid decimal string or is zero or negativeUse a positive decimal string, e.g. '10.00'
ASSET_NOT_SUPPORTED422Asset is not in the app's approved assets listAdd the asset from Dashboard → Settings → Approved assets
INSUFFICIENT_USER_BALANCE422User wallet does not have enough of the assetCheck wallet.balances before sending
NO_TRUSTLINE422Recipient does not have a trustline for the assetCannot send to an account without a trustline for this asset
TRANSACTION_FAILED500Transaction was rejected by StellarCheck the meta field for the Stellar result code
FEE_BUMP_FAILED500Fee-bump signing failedRetry — contact support if it persists

Trustlines

CodeStatusDescriptionResolution
TRUSTLINE_ALREADY_EXISTS409Trustline for this asset already existsSafe to ignore
TRUSTLINE_CREATION_FAILED500Failed to create trustline on StellarRetry — transient network issue

Stellar Network

CodeStatusDescriptionResolution
STELLAR_UNAVAILABLE503Stellar network is unreachablePollar retries automatically. Check status.stellar.org
STELLAR_TIMEOUT504Transaction submitted but not confirmed within timeoutCheck Stellar Explorer with the txHash — the transaction may have landed
LEDGER_FULL503Ledger is full — surge pricing in effectPollar retries with a higher fee automatically

Server

CodeStatusDescriptionResolution
INVALID_REQUEST400Malformed request body or missing required fieldsCheck the request payload against the API reference
NOT_FOUND404Endpoint or resource does not existVerify the URL and resource ID
RATE_LIMITED429Too many requestsBack off and retry. Testnet keys are limited to 1,000 req/day
INTERNAL_ERROR500Unexpected server errorRetry. If it persists, contact support with the request ID from X-Request-Id

Handling errors in the SDK

import { PollarError } from '@pollar/core';

try {
  await pollar.sendPayment({ to: 'GXXX...', amount: '10.00', asset: 'USDC' });
} catch (err) {
  if (err instanceof PollarError) {
    switch (err.code) {
      case 'INSUFFICIENT_USER_BALANCE':
        // show balance error to user
        break;
      case 'STELLAR_UNAVAILABLE':
        // show retry UI
        break;
      default:
        console.error(err.code, err.message);
    }
  }
}

Using the global error handler:

<PollarProvider
  publishableKey="pub_testnet_..."
  onError={(err) => {
    console.error(`[Pollar] ${err.code}: ${err.message}`);
  }}
>
  <App />
</PollarProvider>

On this page

Was this helpful?