{"record":{"id":"0a0804451b274ff9","repo":"nautechsystems/nautilus_trader","slug":"invalid-non-positive-name-price","errorCode":null,"errorMessage":"invalid non-positive {name} price","messagePattern":"invalid non-positive (.+?) price","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/spot/http/client.rs","lineNumber":3077,"sourceCode":"        instrument: &InstrumentAny,\n        snapshot: &BinanceDepth,\n        ts_event: UnixNanos,\n    ) -> anyhow::Result<OrderBook> {\n        let sequence = u64::try_from(snapshot.last_update_id)\n            .map_err(|_| anyhow::anyhow!(\"invalid negative order-book update ID\"))?;\n        let mut book = OrderBook::new(instrument_id, BookType::L2_MBP);\n        let mut add_level = |level: &super::models::BinancePriceLevel,\n                             side: OrderSide,\n                             order_id: usize,\n                             name: &str|\n         -> anyhow::Result<()> {\n            let price = Price::from_mantissa_exponent_checked(\n                level.price_mantissa,\n                snapshot.price_exponent,\n                instrument.price_precision(),\n            )\n            .map_err(|e| anyhow::anyhow!(\"invalid {name} price: {e}\"))?;\n            anyhow::ensure!(price.is_positive(), \"invalid non-positive {name} price\");\n            let qty_mantissa = u64::try_from(level.qty_mantissa)\n                .map_err(|_| anyhow::anyhow!(\"invalid negative {name} quantity\"))?;\n            let quantity = Quantity::from_mantissa_exponent_checked(\n                qty_mantissa,\n                snapshot.qty_exponent,\n                instrument.size_precision(),\n            )\n            .map_err(|e| anyhow::anyhow!(\"invalid {name} quantity: {e}\"))?;\n            anyhow::ensure!(\n                quantity.is_positive(),\n                \"invalid non-positive {name} quantity\"\n            );\n            let order = BookOrder::new(\n                side,\n                price,\n                quantity,\n                u64::try_from(order_id)\n                    .map_err(|_| anyhow::anyhow!(\"order-book level index overflow\"))?,","sourceCodeStart":3059,"sourceCodeEnd":3095,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/spot/http/client.rs#L3059-L3095","documentation":"Thrown when a parsed bid or ask level price is zero or negative. A valid order-book level must have a strictly positive price; `anyhow::ensure!(price.is_positive(), ...)` rejects anything else before the level is added to the book.","triggerScenarios":"Calling `request_book_snapshot` when any depth level decodes to a non-positive price — a malformed or synthetic depth response containing 0 or negative price mantissas.","commonSituations":"Mock servers or fixtures emitting zero-priced levels; corrupted responses from proxies; upstream API anomalies or schema changes.","solutions":["Re-fetch the snapshot; a single bad response is typically transient.","Inspect the raw JSON levels to find the offending zero/negative price.","Fix any proxy/mock fixtures to return realistic positive prices.","Report to the adapter maintainers if a genuine Binance response violates this."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"fn prices_positive(snapshot: &BinanceDepth) -> bool {\n    snapshot.bids.iter().chain(snapshot.asks.iter()).all(|l| l.price_mantissa > 0)\n}","typeGuard":"fn positive_level(l: &BinancePriceLevel) -> bool { l.price_mantissa > 0 }","tryCatchPattern":"match client.request_book_snapshot(id, depth).await {\n    Ok(book) => book,\n    Err(e) if e.to_string().contains(\"non-positive\") => fetch_fresh_snapshot(id, depth).await?,\n    Err(e) => return Err(e),\n}","preventionTips":["Re-fetch the snapshot on transient malformed data.","Sanity-check payloads from proxies/mocks for zero-priced levels.","Report genuine exchange responses that trigger this to maintainers."],"tags":["orderbook","binance","price","validation"],"backgroundTag":"invalid-argument-value","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"}