{"record":{"id":"cee999790611c2f5","repo":"nautechsystems/nautilus_trader","slug":"failed-to-subscribe-to-lighter-account-channel-ch","errorCode":null,"errorMessage":"failed to subscribe to Lighter account channel {channel:?}: {e}","messagePattern":"failed to subscribe to Lighter account channel (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/execution.rs","lineNumber":931,"sourceCode":"                // Subscribe to the five account-scoped streams the consumption\n                // loop converts into typed reports. The handler merges\n                // `account_all_assets` and `user_stats` into a single\n                // AccountState (see websocket/account_state.rs).\n                let channels = [\n                    LighterWsChannel::AccountAllOrders(account_index),\n                    LighterWsChannel::AccountAllTrades(account_index),\n                    LighterWsChannel::AccountAllPositions(account_index),\n                    LighterWsChannel::AccountAllAssets(account_index),\n                    LighterWsChannel::UserStats(account_index),\n                ];\n\n                for channel in channels {\n                    ws_guard\n                        .client_mut()\n                        .subscribe_account(channel.clone(), auth_token.clone())\n                        .await\n                        .map_err(|e| {\n                            anyhow::anyhow!(\n                                \"failed to subscribe to Lighter account channel {channel:?}: {e}\",\n                            )\n                        })?;\n                }\n\n                log::debug!(\"Subscribed to Lighter account streams: account_index={account_index}\",);\n            } else {\n                log::warn!(\n                    \"Lighter execution client has no credentials: account streams not subscribed; \\\n                     typed execution reports will not flow\"\n                );\n            }\n\n            Ok::<(), anyhow::Error>(())\n        };\n\n        if let Err(e) = post_connect.await {\n            log::warn!(\"Lighter post-connect setup failed, tearing down WS: {e}\");","sourceCodeStart":913,"sourceCodeEnd":949,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/execution.rs#L913-L949","documentation":"After setting the execution context, spawn_ws_consumer subscribes to five account-scoped WebSocket channels using an auth token. If subscribe_account fails for any channel, the failure is wrapped with this message naming the channel, aborting connect.","triggerScenarios":"connect() -> spawn_ws_consumer where subscribe_account(channel, auth_token) errors — e.g. expired/invalid auth token, unsupported channel, or WS-level rejection of the subscription for that account.","commonSituations":"Auth token minted with wrong/insufficient credentials; venue API change to channel names; transient WS disconnect between context setup and subscription; account lacks permissions for a channel.","solutions":["Read the channel name in the error and the wrapped {e} to find the failing subscription.","Verify credentials so a valid auth token is minted (re-check API key/secret/expiry).","Retry connect if the failure is a transient WS drop.","Confirm the adapter's channel list matches your venue API version (update adapter).","Check account permissions on Lighter for account-scoped streams."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// ensure a fresh auth token exists before subscribing\nassert!(!auth_token.is_empty(), \"auth token required for account channels\");","typeGuard":null,"tryCatchPattern":"match client.connect().await {\n    Err(e) if e.to_string().contains(\"failed to subscribe to Lighter account channel\") => {\n        // remint auth token and retry; log failing channel from message\n    }\n    r => r?,\n}","preventionTips":["Keep credentials fresh so minted auth tokens are valid.","Retry transient WS subscription failures with backoff.","Track adapter updates for venue channel-name changes.","Confirm account permissions for account-scoped streams."],"tags":["websocket","subscription","authentication","account-streams"],"backgroundTag":"http-error-response","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"}