Skip to main content
Transport errors occur between CosmJS and the RPC node. They depend on which transport you use (HTTP or WebSocket).

HTTP Errors

Bad status (HTTP >= 400) Thrown by the low-level HTTP layer when the node responds with a non-2xx status. The cause property carries the status code and response body:
Common status codes: Request timeout (AbortError) When an HTTP client is configured with a timeout, requests that exceed it throw a DOMException with name === "AbortError":
Invalid URL Thrown immediately if the endpoint URL is missing a protocol:

WebSocket Errors

Connection timeout Thrown when the WebSocket handshake does not complete within the timeout (default: 10 seconds):
Socket closed Thrown when sending on a closed or not-yet-open socket:
Invalid URL

JSON-RPC Errors

When the node returns a JSON-RPC error response, CosmJS throws an Error whose message is the serialized error object. Standard JSON-RPC error codes:

Reconnection

WebsocketClient uses ReconnectingSocket internally with exponential backoff (100ms to 5s). HTTP clients do not retry automatically — implement retries in your application if needed.