{"record":{"id":"863b8bba326ae186","repo":"nautechsystems/nautilus_trader","slug":"invalid-statusmsg","errorCode":null,"errorMessage":"Invalid `StatusMsg`","messagePattern":"Invalid `StatusMsg`","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/databento/src/loader.rs","lineNumber":793,"sourceCode":"            if let Err(e) = dbn_stream.advance() {\n                return Some(Err(e.into()));\n            }\n\n            match dbn_stream.get() {\n                Some(rec) => {\n                    let record = dbn::RecordRef::from(rec);\n                    let instrument_id = match self.resolve_record_instrument_id(\n                        &record,\n                        instrument_id,\n                        &mut metadata_cache,\n                    ) {\n                        Ok(id) => id,\n                        Err(e) => return Some(Err(e)),\n                    };\n\n                    let msg = match record.get::<dbn::StatusMsg>() {\n                        Some(m) => m,\n                        None => return Some(Err(anyhow::anyhow!(\"Invalid `StatusMsg`\"))),\n                    };\n                    let ts_init = msg.ts_recv.into();\n\n                    match decode_status_msg(msg, instrument_id, Some(ts_init)) {\n                        Ok(data) => Some(Ok(data)),\n                        Err(e) => Some(Err(e)),\n                    }\n                }\n                None => None,\n            }\n        }))\n    }\n\n    /// Reads imbalance messages from a DBN IMBALANCE schema file.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if reading imbalance records fails.","sourceCodeStart":775,"sourceCodeEnd":811,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/databento/src/loader.rs#L775-L811","documentation":"`load_status_records` expects every record in the stream to decode as `dbn::StatusMsg`. If `record.get::<StatusMsg>()` returns None (record is of another type), the loader returns this error. It guards against schema/rtype mismatches when loading instrument status data.","triggerScenarios":"Calling `load_status_records` on a DBN file/stream whose records are not status records (wrong schema downloaded, or mixed-record stream where a non-status record appears).","commonSituations":"Downloading `status` schema data but saving/exporting with a different schema, or concatenating multiple schema files into one input.","solutions":["Download with `schema=\"status\"` so the stream contains only StatusMsg records","Check that the file passed to `load_status_records` is the status export, not trades/quotes","Avoid concatenating DBN files of different schemas; process each separately","Inspect the stream's rtype with dbn tooling to confirm it is `instrument_status`"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"assert_eq!(request.schema, \"status\", \"load_status_records requires the status schema\");","typeGuard":"fn is_status_record(rec: &dbn::RecordRef) -> bool {\n    rec.get::<dbn::StatusMsg>().is_some()\n}","tryCatchPattern":"match loader.load_status_records(file, instrument_id) {\n    Ok(d) => d,\n    Err(e) if e.to_string().contains(\"Invalid `StatusMsg`\") => {\n        anyhow::bail!(\"file does not contain status records; check the schema used at download\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Download one schema per file and keep filenames schema-tagged","Never concatenate DBN files with different schemas","Check rtype in the stream header before selecting a loader"],"tags":["databento","record-type-mismatch"],"backgroundTag":"incompatible-source-type","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"}