{"record":{"id":"48541d4e1cfb0c34","repo":"nautechsystems/nautilus_trader","slug":"failed-to-parse-tick-size-new-tick-size-e","errorCode":null,"errorMessage":"Failed to parse tick size '{new_tick_size}': {e}","messagePattern":"Failed to parse tick size '(.+?)': (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/polymarket/src/http/parse.rs","lineNumber":279,"sourceCode":"        .collect()\n}\n\n/// Rebuilds an instrument with a new active tick size and canonical price precision.\n///\n/// All other fields are preserved from `existing`. Returns a new `InstrumentAny`.\npub fn rebuild_instrument_with_tick_size(\n    existing: &InstrumentAny,\n    new_tick_size: &str,\n    ts_event: UnixNanos,\n    ts_init: UnixNanos,\n) -> anyhow::Result<InstrumentAny> {\n    let bo = match existing {\n        InstrumentAny::BinaryOption(b) => b,\n        other => anyhow::bail!(\"Expected BinaryOption, was {other:?}\"),\n    };\n\n    let tick_size = parse_decimal_exact(new_tick_size)\n        .map_err(|e| anyhow::anyhow!(\"Failed to parse tick size '{new_tick_size}': {e}\"))?;\n    let (min_price, max_price) = tick_relative_price_bounds(tick_size)?;\n    let price_increment = min_price;\n\n    let rebuilt = BinaryOption::builder()\n        .instrument_id(bo.id)\n        .raw_symbol(bo.raw_symbol)\n        .asset_class(bo.asset_class)\n        .currency(bo.currency)\n        .activation_ns(bo.activation_ns)\n        .expiration_ns(bo.expiration_ns)\n        .price_precision(POLYMARKET_PRICE_PRECISION)\n        .size_precision(bo.size_precision)\n        .price_increment(price_increment)\n        .size_increment(bo.size_increment)\n        .maybe_outcome(bo.outcome)\n        .maybe_description(bo.description)\n        .maybe_max_quantity(bo.max_quantity)\n        // min_quantity: see `create_instrument_from_def`","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/polymarket/src/http/parse.rs#L261-L297","documentation":"rebuild_instrument_with_tick_size parses the new tick size string with parse_decimal_exact before rebuilding the BinaryOption's price bounds. This error is thrown when the tick-size string from a Polymarket market message is not a valid exact decimal.","triggerScenarios":"handle_market_message receiving a market update whose new_tick_size is empty, non-numeric, or in a format parse_decimal_exact rejects (e.g. scientific notation, thousands separators).","commonSituations":"Unexpected tick_size values in CLOB market channel updates, venue emitting \"0\" or blank during market setup, or locale-formatted numbers from a custom feed.","solutions":["Log the offending new_tick_size value from the market message.","Validate/normalize the tick size string before calling rebuild (trim, reject empty, parse as Decimal).","Skip or defer the instrument rebuild when the tick size is unparseable, and re-sync instruments from the REST snapshot."],"exampleFix":"// before\nlet tick_size = parse_decimal_exact(new_tick_size)\n    .map_err(|e| anyhow::anyhow!(\"Failed to parse tick size '{new_tick_size}': {e}\"))?;\n// after\nlet trimmed = new_tick_size.trim();\nif trimmed.is_empty() { anyhow::bail!(\"skip rebuild: empty tick size\"); }\nlet tick_size = parse_decimal_exact(trimmed)\n    .map_err(|e| anyhow::anyhow!(\"Failed to parse tick size '{new_tick_size}': {e}\"))?;","handlingStrategy":"validation","validationCode":"fn is_valid_tick_size_str(s: &str) -> bool {\n    !s.trim().is_empty() && parse_decimal_exact(s.trim()).map(|d| d > Decimal::ZERO).unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"match rebuild_instrument_with_tick_size(&instrument, &msg.new_tick_size) {\n    Ok(updated) => updated,\n    Err(e) => { warn!(\"tick size update rejected: {e}\"); instrument.clone() }\n}","preventionTips":["Normalize tick size strings (trim, reject empty) before parsing.","Only accept tick sizes known to be representable at Polymarket price precision.","Re-sync instruments from REST when a streamed tick size fails to parse."],"tags":["rust","parsing","decimal","polymarket"],"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"}