{"record":{"id":"9088f9120b1c5d57","repo":"nautechsystems/nautilus_trader","slug":"lighter-does-not-offer-bar-type-on-the-candle-we","errorCode":null,"errorMessage":"Lighter does not offer {bar_type} on the candle WebSocket stream","messagePattern":"Lighter does not offer (.+?) on the candle WebSocket stream","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/data/mod.rs","lineNumber":1258,"sourceCode":"    ) -> anyhow::Result<()> {\n        let instrument_id = subscription.instrument_id;\n\n        let channel = self.perp_market_stats_channel(instrument_id, \"funding rate\")?;\n        self.activate_market_stats_subscription(\n            instrument_id,\n            channel,\n            MarketStatsKind::FundingRate,\n            \"funding rate\",\n        );\n\n        Ok(())\n    }\n\n    fn subscribe_bars(&mut self, subscription: SubscribeBars) -> anyhow::Result<()> {\n        let bar_type = subscription.bar_type;\n\n        let resolution = LighterCandleResolution::try_from(&bar_type)?;\n        anyhow::ensure!(\n            resolution.is_ws_streamable(),\n            \"Lighter does not offer {bar_type} on the candle WebSocket stream\",\n        );\n\n        let instrument_id = bar_type.instrument_id();\n        if !self.instruments.contains_key(&instrument_id) {\n            return Err(InstrumentLookupError::not_found(instrument_id).into());\n        }\n\n        let ws = self.ws_client.clone();\n        self.spawn_task(async move {\n            if let Err(e) = ws.subscribe_candles(instrument_id, resolution).await {\n                log::error!(\"Failed to subscribe to Lighter candles for {bar_type}: {e:?}\");\n            }\n        });\n\n        Ok(())\n    }","sourceCodeStart":1240,"sourceCodeEnd":1276,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/data/mod.rs#L1240-L1276","documentation":"The requested bar type maps to a Lighter candle resolution that is not streamable over the candle WebSocket channel. Lighter only exposes certain resolutions via WebSocket; others must be polled over HTTP. The adapter rejects the subscription up front rather than silently degrading.","triggerScenarios":"Calling subscribe_bars() (or requesting bars via a data engine) with a BarType whose aggregation/resolution maps to a LighterCandleResolution where is_ws_streamable() is false.","commonSituations":"Subscribing to long-interval candles (e.g. 1D bars) expecting WebSocket delivery; copying a bar spec valid on another exchange into a Lighter config.","solutions":["Choose a resolution that Lighter streams over WebSocket (check LighterCandleResolution::is_ws_streamable for supported values).","Switch the bar subscription to an aggregation built from a smaller WS-streamable resolution.","Use request_bars (HTTP polling) instead of a live WebSocket subscription for non-streamable resolutions.","Validate the BarType spec string (e.g. LIGHTER-PERP-1-MINUTE.LIGHTER) before configuring the subscription."],"exampleFix":"// before\nclient.subscribe_bars(SubscribeBars::new(BarType::parse(\"LIGHTER-PERP-1-DAY.LIGHTER\")?));\n// after\nclient.subscribe_bars(SubscribeBars::new(BarType::parse(\"LIGHTER-PERP-1-MINUTE.LIGHTER\")?));","handlingStrategy":"validation","validationCode":"let bar_type = BarType::parse(\"LIGHTER-PERP-1-MINUTE.LIGHTER\")?;\nlet res = LighterCandleResolution::try_from(&bar_type)?;\nif !res.is_ws_streamable() {\n    // fall back to request_bars over HTTP\n}","typeGuard":null,"tryCatchPattern":"match client.subscribe_bars(sub) {\n    Err(e) if e.to_string().contains(\"candle WebSocket stream\") => {\n        client.request_bars(sub.bar_type).await?; // HTTP fallback\n    }\n    r => r?,\n}","preventionTips":["Check LighterCandleResolution::is_ws_streamable before subscribing.","Build bar specs from WS-supported resolutions only.","Use request_bars for long-interval candles."],"tags":["websocket","bars","unsupported-resolution","subscription"],"backgroundTag":"unsupported-operation","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"}