{"record":{"id":"9f4f7d045d1adccc","repo":"nautechsystems/nautilus_trader","slug":"missing-ws-auth-token","errorCode":null,"errorMessage":"missing WS auth token","messagePattern":"missing WS auth token","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"critical","filePath":"crates/adapters/kraken/src/execution/spot.rs","lineNumber":498,"sourceCode":"                            due_post_only,\n                        );\n                    }\n                },\n            }\n\n            Ok(())\n        });\n    }\n    fn submit_via_ws(\n        &self,\n        command: &SubmitOrder,\n        order: &OrderAny,\n        leverage: Option<u16>,\n    ) -> anyhow::Result<()> {\n        let token = self\n            .ws\n            .auth_token_blocking()\n            .ok_or_else(|| anyhow::anyhow!(\"missing WS auth token\"))?;\n\n        let params = build_add_order_params(command, order, token, leverage)?;\n        let identity = PendingRequest {\n            operation: PendingOperation::Submit,\n            client_order_ids: vec![command.client_order_id],\n            venue_order_ids: vec![None],\n            ts_sent_ns: 0,\n            new_quantity: None,\n            new_price: None,\n            new_trigger_price: None,\n        };\n        self.order_request_state\n            .submit(params, identity, self.clock.get_time_ns().as_u64())?;\n        Ok(())\n    }\n\n    fn cancel_single_order(&self, cmd: &CancelOrder) {\n        let use_ws_trade = resolve_use_ws_trade(cmd.params.as_ref(), self.config.use_ws_trade);","sourceCodeStart":480,"sourceCodeEnd":516,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/kraken/src/execution/spot.rs#L480-L516","documentation":"Raised in `submit_via_ws` when submitting a single order over the Kraken spot private WebSocket: `self.ws.auth_token_blocking()` returned `None`, meaning no Kraken WS authentication token is available. Kraken's private WS (`send`/`add_order`) requires a token obtained via the authenticated REST `GetWebSocketsToken` endpoint using valid API key/secret with appropriate permissions.","triggerScenarios":"Calling `submit_single_order` (which routes to `submit_via_ws`) when the auth token was never fetched, the token fetch failed at startup, credentials are absent/invalid, or the token expired and was not refreshed before the call.","commonSituations":"Running the execution client without API key/secret configured; wrong environment (demo credentials on live or vice versa); network failure at startup preventing token acquisition; token expired after a long-idle session; API key lacking the required Kraken permission.","solutions":["Configure valid Kraken API key/secret (env vars or KrakenExecClientConfig) so the client can obtain a WS auth token.","Verify the API key has the necessary trading permissions on Kraken's account settings.","Check startup logs for a failed GetWebSocketsToken request and fix connectivity/credentials, then reconnect.","If tokens expire periodically, ensure the client is reconnected/token-refreshed before submitting orders."],"exampleFix":"// before (token never configured)\nlet config = KrakenExecClientConfig::default(); // no api_key/api_secret\n\n// after\nlet config = KrakenExecClientConfig {\n    api_key: Some(api_key),          // from env/secret store\n    api_secret: Some(api_secret),\n    ..Default::default()\n};\nclient.connect()?; // fetches WS auth token before trading\n","handlingStrategy":"validation","validationCode":"// Before submitting, ensure credentials are present so a WS auth token can be obtained.\nif api_key.is_empty() || api_secret.is_empty() {\n    return Err(anyhow::anyhow!(\"Kraken API key/secret required for WS order submission\"));\n}","typeGuard":null,"tryCatchPattern":"match client.submit_single_order(cmd) {\n    Err(e) if e.to_string().contains(\"missing WS auth token\") => {\n        client.reconnect()?; // re-acquire GetWebSocketsToken, then retry\n        client.submit_single_order(cmd)?;\n    }\n    other => other?,\n}","preventionTips":["Always configure API key/secret on the Kraken execution client before connecting.","Confirm the key has trading permissions in the Kraken account settings.","Check connection/startup logs for successful WS auth token acquisition.","In long-running sessions, reconnect to refresh the token before order bursts.","Pre-flight check: refuse to start a live strategy unless the client reports an auth token."],"tags":["kraken","authentication","websocket","order-submission","credentials"],"backgroundTag":"missing-credentials","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}