{"record":{"id":"cb9cf338477fa3cc","repo":"nautechsystems/nautilus_trader","slug":"unsupported-security-type","errorCode":null,"errorMessage":"Unsupported security type: {:?}","messagePattern":"Unsupported security type: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/interactive_brokers/src/providers/parse.rs","lineNumber":183,"sourceCode":"    details: &ibapi::contracts::ContractDetails,\n    instrument_id: InstrumentId,\n) -> anyhow::Result<InstrumentAny> {\n    let sec_type = &details.contract.security_type;\n\n    match sec_type {\n        SecurityType::Stock => Ok(parse_equity_contract(details, instrument_id)),\n        SecurityType::ForexPair => Ok(parse_forex_contract(details, instrument_id)),\n        SecurityType::Crypto => Ok(parse_crypto_contract(details, instrument_id)),\n        SecurityType::Future | SecurityType::ContinuousFuture => {\n            Ok(parse_futures_contract(details, instrument_id))\n        }\n        SecurityType::Option => parse_option_contract(details, instrument_id),\n        SecurityType::FuturesOption => parse_option_contract(details, instrument_id), // FOP uses same parsing as OPT\n        SecurityType::Index => Ok(parse_index_contract(details, instrument_id)),\n        SecurityType::CFD => Ok(parse_cfd_contract(details, instrument_id)),\n        SecurityType::Commodity => Ok(parse_commodity_contract(details, instrument_id)),\n        SecurityType::Bond => Ok(parse_bond_contract(details, instrument_id)),\n        _ => anyhow::bail!(\"Unsupported security type: {:?}\", sec_type),\n    }\n}\n\nfn ib_contract_info(details: &ibapi::contracts::ContractDetails) -> nautilus_core::Params {\n    let mut info = nautilus_core::Params::new();\n    let mut contract = serde_json::Map::new();\n\n    let contract_params = contract_to_params(&details.contract);\n    for (key, value) in &contract_params {\n        contract.insert(key.clone(), value.clone());\n    }\n\n    info.insert(\"contract\".to_string(), serde_json::Value::Object(contract));\n    info.insert(\n        \"priceMagnifier\".to_string(),\n        serde_json::Value::from(details.price_magnifier),\n    );\n    info","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/interactive_brokers/src/providers/parse.rs#L165-L201","documentation":"parse_ib_contract_to_instrument dispatches on the IB security type and only supports Future, Option, FuturesOption, Index, CFD, Commodity, and Bond. Any other security type (Stock, Forex, Crypto, BAG reaching here, or future API additions) is explicitly unsupported by this parser and fails with the type name in the message.","triggerScenarios":"process_contract_detail or fetch_bag_contract receives ContractDetails whose security type falls into the parser's catch-all `_` arm — e.g. STK, CASH, CRYPTO, or an unfamiliar enum variant.","commonSituations":"Subscribing to instruments of an asset class the IB instrument provider doesn't model (e.g. spot FX or crypto through this parser), or an ibapi crate update introducing new SecurityType variants.","solutions":["Route the contract to the correct adapter path (e.g. equity/forex handling) if one exists, instead of the instrument-details parser.","Restrict configured instruments to supported security types (FUT, OPT, FOP, IND, CFD, COMMODITY, BOND).","If you need the type supported, extend the match in parse_ib_contract_to_instrument with a new parser arm.","Check your ibapi crate version for newly added SecurityType variants and update the match accordingly."],"exampleFix":"// before: unsupported type reaches parser\n// ContractDetails { security_type: SecurityType::Cash, .. } -> bail\n// after: extend the dispatch\nSecurityType::Forex => parse_forex_contract(details, instrument_id),\n_ => anyhow::bail!(\"Unsupported security type: {:?}\", sec_type),","handlingStrategy":"validation","validationCode":"fn security_type_supported(st: SecurityType) -> bool {\n    matches!(st, SecurityType::Future | SecurityType::Option\n        | SecurityType::FuturesOption | SecurityType::Index\n        | SecurityType::Cfd | SecurityType::Commodity | SecurityType::Bond)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Filter configured instruments to supported security types before loading","Check ibapi changelogs for new SecurityType variants after upgrades","Handle unsupported types by skipping, not by pushing them through the parser"],"tags":["interactive-brokers","parsing","security-type","unsupported"],"backgroundTag":"unsupported-enum-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"}