{"record":{"id":"e3dbc620801375d3","repo":"nautechsystems/nautilus_trader","slug":"chart-data-status-is-expected-ok","errorCode":null,"errorMessage":"Chart data status is '{}', expected 'ok'","messagePattern":"Chart data status is '(.+?)', expected 'ok'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/deribit/src/common/parse.rs","lineNumber":868,"sourceCode":"/// instead of `chart_data.volume` (base currency) - see [`use_cost_for_bar_volume`].\n///\n/// # Errors\n///\n/// Returns an error if:\n/// - The status is not \"ok\"\n/// - Array lengths are inconsistent\n/// - No data points are present\npub fn parse_bars(\n    chart_data: &DeribitTradingViewChartData,\n    bar_type: BarType,\n    price_precision: u8,\n    size_precision: u8,\n    use_cost_for_volume: bool,\n    ts_init: UnixNanos,\n) -> anyhow::Result<Vec<Bar>> {\n    // Check status\n    if chart_data.status != \"ok\" {\n        anyhow::bail!(\n            \"Chart data status is '{}', expected 'ok'\",\n            chart_data.status\n        );\n    }\n\n    let num_bars = chart_data.ticks.len();\n\n    // Verify array lengths match\n    anyhow::ensure!(\n        chart_data.open.len() == num_bars\n            && chart_data.high.len() == num_bars\n            && chart_data.low.len() == num_bars\n            && chart_data.close.len() == num_bars\n            && chart_data.volume.len() == num_bars\n            && chart_data.cost.len() == num_bars,\n        \"Inconsistent array lengths in chart data\"\n    );\n","sourceCodeStart":850,"sourceCodeEnd":886,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/deribit/src/common/parse.rs#L850-L886","documentation":"parse_bars validates that the Deribit tradingview chart_data response reports status 'ok' before converting ticks into bars. Any other status (e.g. 'error', 'no_data') means the tick data is unusable, so parsing fails.","triggerScenarios":"Calling parse_bars with a GetChartTradesResponse whose status != \"ok\" — Deribit rejected the chart request or returned no valid data.","commonSituations":"Requesting chart data for an invalid/unknown instrument_name or out-of-range time window, Deribit rate limiting, instrument without trading history.","solutions":["Validate instrument_name and the start/end timestamps of the bar request","Check response status before calling parse_bars and surface a clearer error","Handle 'no_data' style statuses gracefully for instruments with no history","Check for Deribit rate limits or API errors in the request path"],"exampleFix":"// before\nlet bars = parse_bars(&chart_data, ...)?; // may fail on status\n// after\nif chart_data.status != \"ok\" {\n    log::warn!(\"Chart data unavailable: status={}\", chart_data.status);\n    return Ok(Vec::new());\n}\nlet bars = parse_bars(&chart_data, ...)?;","handlingStrategy":"validation","validationCode":"if chart_data.status != \"ok\" {\n    log::warn!(\"chart status={}, skipping parse\", chart_data.status);\n    return Ok(Vec::new());\n}","typeGuard":"fn chart_ok(c: &GetChartTradesResponse) -> bool { c.status == \"ok\" }","tryCatchPattern":"match parse_bars(&chart_data, ...).await /* or sync */ {\n    Err(e) if e.to_string().contains(\"expected 'ok'\") => {\n        warn!(\"chart data unavailable: {}\", chart_data.status);\n        return Ok(Vec::new());\n    }\n    other => other?,\n}","preventionTips":["Validate instrument_name and request window before fetching chart data","Handle no-history instruments gracefully","Watch for rate limiting affecting chart endpoints"],"tags":["deribit","bars","chart-data","parsing"],"backgroundTag":"unexpected-api-response-shape","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"}