{"record":{"id":"c91587c8470236fa","repo":"nautechsystems/nautilus_trader","slug":"implement-fromrow-for-futuresspread","errorCode":null,"errorMessage":"Implement FromRow for FuturesSpread","messagePattern":"Implement FromRow for FuturesSpread","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/infrastructure/src/sql/models/instruments.rs","lineNumber":998,"sourceCode":"            .maybe_max_quantity(max_quantity)\n            .maybe_min_quantity(min_quantity)\n            .maybe_max_price(max_price)\n            .maybe_min_price(min_price)\n            .maybe_margin_init(margin_init)\n            .maybe_margin_maint(margin_maint)\n            .maybe_maker_fee(maker_fee)\n            .maybe_taker_fee(taker_fee)\n            .ts_event(ts_event)\n            .ts_init(ts_init)\n            .build()\n            .unwrap();\n        Ok(Self(inst))\n    }\n}\n\nimpl<'r> FromRow<'r, PgRow> for FuturesSpreadRow {\n    fn from_row(_row: &'r PgRow) -> Result<Self, sqlx::Error> {\n        todo!(\"Implement FromRow for FuturesSpread\")\n    }\n}\n\nimpl<'r> FromRow<'r, PgRow> for OptionContractRow {\n    fn from_row(row: &'r PgRow) -> Result<Self, sqlx::Error> {\n        let id = row.try_get::<String, _>(\"id\").map(InstrumentId::from)?;\n        let raw_symbol = row.try_get::<String, _>(\"raw_symbol\").map(Symbol::new)?;\n        let asset_class = row\n            .try_get::<AssetClassPg, _>(\"asset_class\")\n            .map(|res| res.0)?;\n        let exchange = row\n            .try_get::<Option<String>, _>(\"exchange\")\n            .map(|res| res.map(|s| Ustr::from(s.as_str())))?;\n        let underlying = row\n            .try_get::<String, _>(\"underlying\")\n            .map(|res| Ustr::from(res.as_str()))?;\n        let option_kind = row\n            .try_get::<String, _>(\"option_kind\")","sourceCodeStart":980,"sourceCodeEnd":1016,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/infrastructure/src/sql/models/instruments.rs#L980-L1016","documentation":"This is a deliberate `todo!()` placeholder in `FromRow for FuturesSpreadRow`, meaning futures-spread instrument rows cannot yet be deserialized from Postgres. Any query returning FuturesSpreadRow via sqlx panics with this message instead of returning a row. It is unfinished implementation, not a runtime condition the caller caused.","triggerScenarios":"Any sqlx query whose output is decoded into FuturesSpreadRow via PgRow, e.g. fetching futures spread instruments from the instruments table.","commonSituations":"Developer writes or runs a query loading futures spread instruments; a load-all instruments routine reaches the spread branch; integration test exercising instrument persistence for spreads.","solutions":["Implement from_row for FuturesSpreadRow by try_get-ing each column and constructing the inner instrument (mirror the adjacent OptionContractRow impl)","As a stopgap, filter queries to exclude futures spread rows until the impl lands","Raise/track an upstream issue in nautilus_infrastructure that FuturesSpread persistence is unimplemented"],"exampleFix":"// before\nfn from_row(_row: &'r PgRow) -> Result<Self, sqlx::Error> {\n    todo!(\"Implement FromRow for FuturesSpread\")\n}\n// after\nfn from_row(row: &'r PgRow) -> Result<Self, sqlx::Error> {\n    let id = row.try_get::<String, _>(\"id\").map(InstrumentId::from)?;\n    let raw_symbol = row.try_get::<String, _>(\"raw_symbol\")?.into();\n    // ... try_get remaining columns, build InstrumentAny::FuturesSpread(...)\n    Ok(Self(inst))\n}","handlingStrategy":"validation","validationCode":"// Guard before decoding\nif matches!(instrument_def, InstrumentDef::FuturesSpread(_)) {\n    return Err(\"FuturesSpread persistence not implemented\".into());\n}","typeGuard":null,"tryCatchPattern":"// todo! panics cannot be caught safely; filter rows instead\nlet rows: Vec<ContractRow> = sqlx::query(query).fetch_all(&pool).await?;","preventionTips":["Check the adapter's supported instrument types before writing persistence queries","Search the crate for todo!/unimplemented! in FromRow impls before relying on generic load-all code paths"],"tags":["rust","sqlx","unimplemented","panic","database"],"backgroundTag":"method-not-implemented","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"}