{"record":{"id":"71b4581ec3cb5058","repo":"nautechsystems/nautilus_trader","slug":"coinbase-websocket-handler-failed-error","errorCode":null,"errorMessage":"Coinbase WebSocket handler failed: {error}","messagePattern":"Coinbase WebSocket handler failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/coinbase/src/websocket/client.rs","lineNumber":238,"sourceCode":"\n    /// Establishes the WebSocket connection and spawns the feed handler.\n    pub async fn connect(&mut self) -> anyhow::Result<()> {\n        if self.is_active() || self.is_reconnecting() {\n            log::warn!(\"WebSocket already connected or reconnecting\");\n            return Ok(());\n        }\n\n        if let Some(outcome) = finish_task(\n            &mut self.task_handle,\n            WS_DISCONNECT_TIMEOUT,\n            WS_DISCONNECT_TIMEOUT,\n        )\n        .await\n        {\n            match outcome {\n                TaskJoinOutcome::Completed(()) | TaskJoinOutcome::Aborted => {}\n                TaskJoinOutcome::Failed(error) => {\n                    anyhow::bail!(\"Coinbase WebSocket handler failed: {error}\");\n                }\n                TaskJoinOutcome::Incomplete => {\n                    anyhow::bail!(\"Coinbase WebSocket handler did not stop after abort\");\n                }\n            }\n        }\n\n        // Clear stop signal from any previous disconnect\n        self.signal.store(false, Ordering::Relaxed);\n\n        let (message_handler, raw_rx) = channel_message_handler();\n        let cfg = WebSocketConfig {\n            url: self.url.clone(),\n            headers: vec![],\n            // Coinbase uses TCP control-frame pings for transport keep-alive;\n            // application-layer liveness comes from the heartbeats channel.\n            heartbeat_interval_secs: Some(WS_HEARTBEAT_SECS),\n            heartbeat_payload: None,","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/coinbase/src/websocket/client.rs#L220-L256","documentation":"During WebSocket connect, the adapter awaits the spawned handler task and inspects its join outcome. If the handler task ended in the Failed state, its error is surfaced wrapped as \"Coinbase WebSocket handler failed: {error}\" so the underlying cause (auth, subscription, stream error) is preserved.","triggerScenarios":"connect() completes after the handler task panicked/errored — e.g. the handler failed during initial subscribe, authentication, or message processing and returned Err.","commonSituations":"Invalid API credentials for the user channel; WebSocket URL unreachable; handler hit a parse/protocol error and exited before connect() finished setup.","solutions":["Read the wrapped {error} for the root cause","Verify API key/secret and that the requested channels require correct credentials","Check network/proxy access to the Coinbase WebSocket URL and retry"],"exampleFix":"// inspect inner error\nmatch ws.connect().await {\n    Err(e) => { log::error!(\"root cause: {:#}\", e); }\n    Ok(_) => {}\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match ws.connect().await {\n    Err(e) => {\n        log::error!(\"ws connect failed: {:#}\", e); // inspect wrapped handler error\n        // backoff then retry\n    }\n    Ok(_) => {}\n}","preventionTips":["Verify credentials before connecting to authenticated channels","Add exponential backoff reconnect logic","Monitor the inner error text, not just the wrapper"],"tags":["rust","coinbase","websocket","connection"],"backgroundTag":"websocket-connection-failed","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}