value (and, for a Solana event in JS, timestamp or sourceChainId) raises the language’s own TypeError, not a PeaqosError. Faucet-specific codes are surfaced on the error instance (error.code) so callers can branch without string matching.
Class hierarchy
- JavaScript
- Python
PeaqosError directly. Each function area adds its own family alongside them, also extending PeaqosError: MonetizationError (with MonetizationCompatibilityError), ProvisioningError, StreamError, OrchestrationError, and the Economics 2.0 family TokenomicsConfigError, TokenomicsActivationError (with its subclass TokenomicsPendingTransactionError), TokenomicsUnsupportedError, TokenomicsIntegrationUnavailableError (see Tokenomics 2.0 errors). McrApiError, a RuntimeError subclass, covers MCR query HTTP, transport and non-JSON failures; response shape and correlation failures are RuntimeError with code BAD_RESPONSE (see MCR API error codes). So 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: activation, machine management, and the 2.0 monetization client. Codes are string literals onerr.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.POST /faucet/fund, POST /2fa/setup, and POST /2fa/confirm each return a subset. For example, QR_GENERATION_FAILED only comes from /2fa/setup. QR_NOT_FOUND and QR_EXPIRED come from GET /2fa/qr/{token} when you open the qrImageUrl, so they reach your HTTP client, not an SDK error. Codes surface as RuntimeError.code (JS) or ApiError.code (Python).
2FA errors
2FA errors
Idempotency errors
Idempotency errors
Rate limit & cap errors
Rate limit & cap errors
Validation errors
Validation errors
Chain & server errors
Chain & server errors
QR errors
QR errors
On-chain revert names (Tokenomics 1.0)
These are theIdentityRegistry, 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 byqueryMcr / query_mcr, queryMachine / query_machine, and queryOperatorMachines / query_operator_machines against the deployment’s MCR server (mcr.peaq.xyz); the helpers need a tokenomics20 client. In JS, HTTP, transport and non-JSON failures throw McrApiError (a RuntimeError subclass) with these codes, and response shape and correlation failures (a malformed or non-canonical machine_id, a response about a different machine or operator than requested, a null or non-integer mcr_score) throw RuntimeError with code BAD_RESPONSE. In Python every one of these failures is ApiError with the same codes. Both SDKs carry the server’s own code on serverCode / server_code plus httpStatus / http_status, homeProtocolChainId / home_protocol_chain_id and retryable (a classification only; the transport never retries). The constants are MCR_HTTP_ERROR_CODE in both SDKs.
Verify errors
Raised by the experimental Verify surface (@peaqos/peaq-os-sdk/verify, peaq_os_sdk.verify). All extend VerifyError, a PeaqosError; the typed fields carry the outcome and the messages hold no server text, URLs or identifiers. Full tables in SDK JS: Verify and SDK Python: Verify.
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(field="transaction"); the other four become a plain PeaqosError in both SDKs. Python sets the OWS code on err.code and chains the raw error as __cause__; JS keeps the raw error on err.cause and sets no code.
Constants exported from the JS SDK root and from
peaq_os_sdk.constants in Python 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.
In JS SDK 0.10.0 an OWS signing failure surfaces as a PeaqosError with no code, and err.cause.code is the native binding’s "GenericFailure", so the OWS codes cannot be branched on in JS yet; log err.message instead. In Python, branch on err.code:
SDK transaction sentinels
Raised by the SDK’s transaction helper around any contract call. Surfaced asRuntimeError.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 asApiError.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 asRuntimeError.code (JS) or ValidationError/RpcError attributes (Python).
Error handling patterns
- JavaScript
- Python

