{"record":{"id":"26855d7bd5a7f9c6","repo":"nautechsystems/nautilus_trader","slug":"unsupported-derive-instrument-type-for-trades-ot","errorCode":null,"errorMessage":"unsupported Derive instrument type for trades: {other:?}","messagePattern":"unsupported Derive instrument type for trades: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/derive/src/data.rs","lineNumber":2392,"sourceCode":"\n    DeriveTickerInterval::from_str(&interval)\n        .with_context(|| format!(\"invalid Derive ticker interval `{interval}`\"))?;\n    Ok(interval)\n}\n\nfn trade_channel(instrument: &InstrumentAny) -> anyhow::Result<String> {\n    let instrument_type = derive_instrument_type(instrument)?.to_string();\n    let instrument_id = instrument.id();\n    let currency = currency_from_instrument_id(&instrument_id)?;\n    Ok(trades_channel(&instrument_type, currency))\n}\n\nfn derive_instrument_type(instrument: &InstrumentAny) -> anyhow::Result<DeriveInstrumentType> {\n    match instrument {\n        InstrumentAny::CryptoPerpetual(_) => Ok(DeriveInstrumentType::Perp),\n        InstrumentAny::CryptoOption(_) => Ok(DeriveInstrumentType::Option),\n        InstrumentAny::CurrencyPair(_) => Ok(DeriveInstrumentType::Erc20),\n        other => anyhow::bail!(\"unsupported Derive instrument type for trades: {other:?}\"),\n    }\n}\n\nfn currency_from_instrument_id(instrument_id: &InstrumentId) -> anyhow::Result<&str> {\n    anyhow::ensure!(\n        instrument_id.venue == *DERIVE_VENUE,\n        \"instrument ID `{instrument_id}` is not for venue {}\",\n        DERIVE_VENUE.as_str(),\n    );\n\n    instrument_id\n        .symbol\n        .as_str()\n        .split_once('-')\n        .and_then(|(currency, _)| (!currency.is_empty()).then_some(currency))\n        .ok_or_else(|| anyhow::anyhow!(\"cannot derive currency from {instrument_id}\"))\n}\n","sourceCodeStart":2374,"sourceCodeEnd":2410,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/derive/src/data.rs#L2374-L2410","documentation":"The Derive adapter can only map Nautilus instruments of type CryptoPerpetual, CryptoOption, or CurrencyPair to a DeriveInstrumentType when creating/dispatching trades. Any other instrument kind (e.g. FuturesContract, Equity, etc.) hits the catch-all arm and bails. It is an adapter capability guard, not a data corruption issue.","triggerScenarios":"Calling trade-parsing paths (e.g. parse_md_message dispatching trade prints, or create_architect_trade_id-style flows in test harnesses) with an InstrumentAny that is not CryptoPerpetual, CryptoOption, or CurrencyPair.","commonSituations":"Subscribing to trades on a Derive instrument loaded as the wrong instrument type; feeding instruments from another venue into the Derive adapter; a new instrument kind added upstream but not yet supported by derive_instrument_type.","solutions":["Use a supported instrument type (CryptoPerpetual, CryptoOption, or CurrencyPair) when loading/subscribing Derive instruments","Check that instrument providers load Derive instruments as CurrencyPair for spot markets, not as another type","If a legitimate instrument type is missing, add an arm to derive_instrument_type in crates/adapters/derive/src/data.rs mapping it to the correct DeriveInstrumentType","Filter unsupported instrument kinds out before subscribing to trade data"],"exampleFix":"// before\nlet instrument = loader.load_instrument(id)?; // returns FuturesContract\n// after\nlet instrument = loader.load_instrument_as_currency_pair(id)?; // CurrencyPair is supported","handlingStrategy":"type-guard","validationCode":"fn is_derive_trade_capable(i: &InstrumentAny) -> bool {\n    matches!(i, InstrumentAny::CryptoPerpetual(_) | InstrumentAny::CryptoOption(_) | InstrumentAny::CurrencyPair(_))\n}\nif !is_derive_trade_capable(&inst) { skip_subscription(inst.id()); }","typeGuard":"fn as_supported(i: &InstrumentAny) -> Option<&DeriveInstrumentType> {\n    match i {\n        InstrumentAny::CryptoPerpetual(_) => Some(&DeriveInstrumentType::Perp),\n        InstrumentAny::CryptoOption(_) => Some(&DeriveInstrumentType::Option),\n        InstrumentAny::CurrencyPair(_) => Some(&DeriveInstrumentType::Erc20),\n        _ => None,\n    }\n}","tryCatchPattern":"match derive_instrument_type(&inst) {\n    Ok(t) => proceed(t),\n    Err(e) => { log::warn!(\"skipping {}: {e}\", inst.id()); }\n}","preventionTips":["Load Derive instruments through the Derive instrument provider so types map correctly","Only subscribe to trade data for Perp/Option/Erc20 instrument kinds","Add a startup assertion that all configured instruments pass the type check"],"tags":["rust","adapter","instrument-type","unsupported"],"backgroundTag":"unsupported-operation","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"}