nautechsystems/nautilus_trader · error
Lighter does not offer {bar_type} on the candle WebSocket st
Error message
Lighter does not offer {bar_type} on the candle WebSocket stream What it means
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.
Source
Thrown at crates/adapters/lighter/src/data/mod.rs:1258
) -> anyhow::Result<()> {
let instrument_id = subscription.instrument_id;
let channel = self.perp_market_stats_channel(instrument_id, "funding rate")?;
self.activate_market_stats_subscription(
instrument_id,
channel,
MarketStatsKind::FundingRate,
"funding rate",
);
Ok(())
}
fn subscribe_bars(&mut self, subscription: SubscribeBars) -> anyhow::Result<()> {
let bar_type = subscription.bar_type;
let resolution = LighterCandleResolution::try_from(&bar_type)?;
anyhow::ensure!(
resolution.is_ws_streamable(),
"Lighter does not offer {bar_type} on the candle WebSocket stream",
);
let instrument_id = bar_type.instrument_id();
if !self.instruments.contains_key(&instrument_id) {
return Err(InstrumentLookupError::not_found(instrument_id).into());
}
let ws = self.ws_client.clone();
self.spawn_task(async move {
if let Err(e) = ws.subscribe_candles(instrument_id, resolution).await {
log::error!("Failed to subscribe to Lighter candles for {bar_type}: {e:?}");
}
});
Ok(())
}View on GitHub (pinned to 18893faf8b)
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.
Example fix
// before
client.subscribe_bars(SubscribeBars::new(BarType::parse("LIGHTER-PERP-1-DAY.LIGHTER")?));
// after
client.subscribe_bars(SubscribeBars::new(BarType::parse("LIGHTER-PERP-1-MINUTE.LIGHTER")?)); Defensive patterns
Strategy: validation
Validate before calling
let bar_type = BarType::parse("LIGHTER-PERP-1-MINUTE.LIGHTER")?;
let res = LighterCandleResolution::try_from(&bar_type)?;
if !res.is_ws_streamable() {
// fall back to request_bars over HTTP
} Try / catch
match client.subscribe_bars(sub) {
Err(e) if e.to_string().contains("candle WebSocket stream") => {
client.request_bars(sub.bar_type).await?; // HTTP fallback
}
r => r?,
} Prevention
- Check LighterCandleResolution::is_ws_streamable before subscribing.
- Build bar specs from WS-supported resolutions only.
- Use request_bars for long-interval candles.
When it happens
Trigger: 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.
Common situations: Subscribing to long-interval candles (e.g. 1D bars) expecting WebSocket delivery; copying a bar spec valid on another exchange into a Lighter config.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- WS user data subscription timed out
- subscription confirmation failed: {e}
- Unsupported Deribit resolution: {resolution}
- invalid Derive subscription channel `{channel}`
- Failed to send UpdateInstrument command: {e}
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/9088f9120b1c5d57.
Report an issue: GitHub.