{"record":{"id":"53ad3e95d8433b90","repo":"nautechsystems/nautilus_trader","slug":"invalid-candle-high-e","errorCode":null,"errorMessage":"invalid candle high: {e}","messagePattern":"invalid candle high: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/lighter/src/http/parse.rs","lineNumber":217,"sourceCode":"        \"non-positive candle low `{}`\",\n        candle.low\n    );\n    anyhow::ensure!(\n        candle.close > Decimal::ZERO,\n        \"non-positive candle close `{}`\",\n        candle.close\n    );\n\n    let timestamp_ms =\n        u64::try_from(candle.timestamp).context(\"negative Lighter candle timestamp\")?;\n    let ts_event = parse_millis_to_nanos(timestamp_ms)?;\n    let price_precision = instrument.price_precision();\n    let size_precision = instrument.size_precision();\n\n    let open = Price::from_decimal_dp(candle.open, price_precision)\n        .map_err(|e| anyhow::anyhow!(\"invalid candle open: {e}\"))?;\n    let high = Price::from_decimal_dp(candle.high, price_precision)\n        .map_err(|e| anyhow::anyhow!(\"invalid candle high: {e}\"))?;\n    let low = Price::from_decimal_dp(candle.low, price_precision)\n        .map_err(|e| anyhow::anyhow!(\"invalid candle low: {e}\"))?;\n    let close = Price::from_decimal_dp(candle.close, price_precision)\n        .map_err(|e| anyhow::anyhow!(\"invalid candle close: {e}\"))?;\n    anyhow::ensure!(\n        candle.volume_base.is_sign_positive(),\n        \"negative candle volume `{}`\",\n        candle.volume_base,\n    );\n    let volume = Quantity::from_decimal_dp(candle.volume_base, size_precision)\n        .map_err(|e| anyhow::anyhow!(\"invalid candle volume: {e}\"))?;\n\n    Bar::new_checked(bar_type, open, high, low, close, volume, ts_event, ts_init)\n        .context(\"failed to construct Bar from Lighter candle\")\n}\n\n/// Parses a Lighter historical funding row into a Nautilus [`FundingRateUpdate`].\n///","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/lighter/src/http/parse.rs#L199-L235","documentation":"This wraps a failure converting the candle's high Decimal to a Price at the instrument's price_precision inside parse_candle_bar. Price::from_decimal_dp rejected the value, so the candle cannot be represented at the instrument's precision. The original conversion error is preserved as the cause.","triggerScenarios":"LighterCandle.high failing Price::from_decimal_dp(high, price_precision) — typically a non-finite decimal or a value incompatible with the instrument's precision when parsing candles via parse_bars.","commonSituations":"Corrupt upstream highs (NaN/inf); instrument precision mismatched with the market's tick size; passing the wrong instrument to parse_candle_bar.","solutions":["Inspect the chained cause for the precise from_decimal_dp failure","Confirm the instrument used has the correct price_precision for this market","Validate the candle high is finite and sane before conversion","Verify the raw API payload for anomalous high values"],"exampleFix":"// before\nlet high = Price::from_decimal_dp(candle.high, price_precision)?;\n// after\nlet high = Price::from_decimal_dp(candle.high.round_dp(price_precision as u32), price_precision)?;","handlingStrategy":"try-catch","validationCode":"anyhow::ensure!(candle.high.is_finite(), \"non-finite candle high: {}\", candle.high);","typeGuard":"fn convertible_high(c: &LighterCandle, precision: u8) -> bool {\n    c.high.is_finite() && c.high > Decimal::ZERO\n}","tryCatchPattern":"let high = Price::from_decimal_dp(candle.high, price_precision)\n    .map_err(|e| anyhow::anyhow!(\"invalid candle high: {e}\"))\n    .with_context(|| format!(\"candle for {}\", instrument.id()))?;","preventionTips":["Match price_precision to the market's actual tick size","Reject non-finite decimals upstream of the parser","Use the correct instrument definition per market","Watch for API schema changes altering decimal formats"],"tags":["rust","price-conversion","candles","precision"],"backgroundTag":"invalid-argument-format","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"}