Skip to main content
Every error raised by the extends a common base. Faucet-specific codes are surfaced on the error instance (error.code) so callers can branch without string matching.

Class hierarchy

These four extend PeaqosError directly. Each function area adds its own family alongside them, also extending PeaqosError: MonetizationError (plus MonetizationCompatibilityError since 0.6.0), ProvisioningError, StreamError, OrchestrationError, and since 0.6.0 the Economics 2.0 family TokenomicsConfigError, TokenomicsActivationError, TokenomicsUnsupportedError, TokenomicsIntegrationUnavailableError (see Tokenomics 2.0 errors). So catch (err instanceof PeaqosError) covers every SDK error; catching RuntimeError alone will miss ValueCapExceeded and RateLimitExceeded.

Tokenomics 2.0 errors

Raised by the Economics 2.0 surface (SDK 0.6.0+): activation, machine management, and the 2.0 monetization client. Codes are string literals on err.code in both SDKs; the contract a revert came from travels on err.contract, and reverts are decoded by 4-byte selector scoped to that contract’s ABI. An unrecognised selector still surfaces as CONTRACT_REVERTED with the raw revertData / revert_data. Error messages pass through credential redaction (URL userinfo, secret query parameters, 32-byte hex). Revert data and transaction hashes are kept unredacted on the attributes.

Faucet error codes

All 20 codes the can return from POST /faucet/fund, POST /2fa/setup, and POST /2fa/confirm. Each endpoint returns a subset. For example, INVALID_OWNER_ADDRESS and QR_GENERATION_FAILED only come from /2fa/setup. Codes surface as RuntimeError.code (JS) or ApiError.code (Python).
Full flow reference: Gas Station concept, setupFaucet2FA, fund_from_gas_station.

On-chain revert names (Tokenomics 1.0)

These are the IdentityRegistry, IdentityStaking, MachineNFT, and EventRegistry reverts. Economics 2.0 reverts are decoded per contract into the TokenomicsActivationError codes above. names the SDK translates to a friendly message and surfaces as RuntimeError.code (JS) or RpcError.code (Python). The contracts define more custom errors than this table; anything not listed surfaces as code: "TX_REVERTED" (Python) or code: "<RawErrorName>" with a generic Transaction reverted: … message (JS, when viem decodes the selector).

MCR API error codes

Returned by queryMcr / query_mcr, queryMachine / query_machine, and queryOperatorMachines / query_operator_machines against the MCR API: mcr.peaq.xyz in legacy mode, the deployment’s 2.0 server (mcr-20.peaq.xyz) in Tokenomics mode since JS 0.7.0 / Python 0.7.1. Surfaced as RuntimeError.code (JS) or ApiError.code (Python). In Tokenomics mode a malformed or non-canonical machine_id, or a response about a different machine or operator than requested, is BAD_RESPONSE.

OWS signing error codes

Raised when routes through an (PeaqosClient.fromWallet / from_wallet with owsSigning=true). The SDK normalises the upstream OWS error code into a typed SDK exception — only INVALID_INPUT becomes ValidationError; the other four become PeaqosError (or RuntimeError in JS) with the original OWS error preserved as .cause. Constants exported from both SDKs as OWS_ERROR_WALLET_NOT_FOUND, OWS_ERROR_INVALID_PASSPHRASE, OWS_ERROR_INVALID_INPUT, OWS_ERROR_POLICY_DENIED, OWS_ERROR_CHAIN_NOT_SUPPORTED. JS additionally exports the OwsSigningErrorCode union type.

SDK transaction sentinels

Raised by the SDK’s transaction helper around any contract call. Surfaced as RuntimeError.code (JS) or RpcError.code (Python).

Faucet / HTTP envelope sentinels

Raised by the SDK when a faucet or MCR response is reachable but unparseable. Surfaced as ApiError.code (Python). The JS SDK collapses these into the generic RuntimeError envelope path.

Client-side error codes

Raised by the SDK itself (not by a chain revert). Surfaced as RuntimeError.code (JS) or ValidationError/RpcError attributes (Python).

Error handling patterns