{"record":{"id":"851ffed9438a9200","repo":"nautechsystems/nautilus_trader","slug":"missing-field-field-in-filter","errorCode":null,"errorMessage":"Missing field '{field}' in filter","messagePattern":"Missing field '(.+?)' in filter","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/common/parse.rs","lineNumber":153,"sourceCode":"    Currency::get_or_create_crypto(code)\n}\n\n/// Extracts filter values from Binance symbol filters array.\nfn get_filter<'a>(filters: &'a [Value], filter_type: &str) -> Option<&'a Value> {\n    filters.iter().find(|f| {\n        f.get(\"filterType\")\n            .and_then(|v| v.as_str())\n            .is_some_and(|t| t == filter_type)\n    })\n}\n\n/// Parses a string field from a JSON value.\nfn parse_filter_string(filter: &Value, field: &str) -> anyhow::Result<String> {\n    filter\n        .get(field)\n        .and_then(|v| v.as_str())\n        .map(String::from)\n        .ok_or_else(|| anyhow::anyhow!(\"Missing field '{field}' in filter\"))\n}\n\n/// Parses a Price from a filter field.\nfn parse_filter_price(filter: &Value, field: &str) -> anyhow::Result<Price> {\n    let value = parse_filter_string(filter, field)?;\n    Price::from_str(&value).map_err(|e| anyhow::anyhow!(\"Failed to parse {field}='{value}': {e}\"))\n}\n\n/// Parses a Quantity from a filter field.\nfn parse_filter_quantity(filter: &Value, field: &str) -> anyhow::Result<Quantity> {\n    let value = parse_filter_string(filter, field)?;\n    Quantity::from_str(&value)\n        .map_err(|e| anyhow::anyhow!(\"Failed to parse {field}='{value}': {e}\"))\n}\n\n/// Parses the futures `MIN_NOTIONAL` filter into a `Money` value in `currency`.\n///\n/// Returns `None` when the filter is absent, the `notional` field cannot be","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/common/parse.rs#L135-L171","documentation":"parse_filter_string extracts a string field from a Binance exchange filter JSON object (e.g. tickSize, stepSize fields of PRICE_FILTER or LOT_SIZE). This error is raised when the field is absent or present but not a JSON string, so the filter cannot be parsed into an instrument.","triggerScenarios":"Parsing exchangeInfo filters where the expected field (e.g. 'minPrice', 'tickSize', 'stepSize') is missing from the filter object, or its value is a number rather than a string — common with non-standard filters or schema changes.","commonSituations":"Binance adding new filter types not handled by the parser; mocked exchangeInfo fixtures missing fields; secondary filter objects (e.g. PERCENT_PRICE fields) passed to the wrong parse function; proxies re-serializing numeric strings as numbers.","solutions":["Ensure the filter object actually contains the expected field as a JSON string, matching Binance's exchangeInfo schema.","Check you are calling the right parse function for the filter type (parse_filter_price vs parse_filter_quantity fields).","Update the adapter if Binance changed the filter schema (e.g. switched string fields to numbers).","Log the full filter JSON to see which filter/field is malformed."],"exampleFix":"// before\nlet filter = json!({\"filterType\": \"PRICE_FILTER\"}); // missing tickSize\n\n// after\nlet filter = json!({\"filterType\": \"PRICE_FILTER\", \"tickSize\": \"0.01\"});","handlingStrategy":"validation","validationCode":"fn filter_has_string(filter: &serde_json::Value, field: &str) -> bool {\n    filter.get(field).and_then(|v| v.as_str()).is_some()\n}","typeGuard":null,"tryCatchPattern":"// match parse_filter_price(&filter, \"tickSize\") {\n//     Ok(p) => p,\n//     Err(e) => { log::warn!(\"skipping symbol, bad filter: {e}\"); continue; }\n// }","preventionTips":["Only pass filters of the matching type to each parse function.","Generate test fixtures from live exchangeInfo data.","Skip-and-log unknown filter types when parsing instrument lists."],"tags":["binance","json","filters","missing-field"],"backgroundTag":"missing-required-argument","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}