{"record":{"id":"3b24ac6c7609b6e8","repo":"nautechsystems/nautilus_trader","slug":"invalid-publisher-for-record-e","errorCode":null,"errorMessage":"Invalid `publisher` for record: {e}","messagePattern":"Invalid `publisher` for record: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/databento/src/loader.rs","lineNumber":278,"sourceCode":"                }\n\n                let rec = dbn_stream.get()?;\n\n                let result: anyhow::Result<Option<InstrumentAny>> = (|| {\n                    let record = dbn::RecordRef::from(rec);\n                    let msg = record\n                        .get::<InstrumentDefMsg>()\n                        .ok_or_else(|| anyhow::anyhow!(\"Failed to decode InstrumentDefMsg\"))?;\n\n                    let raw_symbol = rec\n                        .raw_symbol()\n                        .map_err(|e| anyhow::anyhow!(\"Error decoding `raw_symbol`: {e}\"))?;\n                    let symbol = Symbol::from(raw_symbol);\n\n                    let publisher = rec\n                        .hd\n                        .publisher()\n                        .map_err(|e| anyhow::anyhow!(\"Invalid `publisher` for record: {e}\"))?;\n                    let venue = match publisher {\n                        Publisher::GlbxMdp3Glbx if use_exchange_as_venue => {\n                            let exchange = rec.exchange().map_err(|e| {\n                                anyhow::anyhow!(\"Missing `exchange` for record: {e}\")\n                            })?;\n                            let venue = Venue::from_code(exchange).map_err(|e| {\n                                anyhow::anyhow!(\"Venue not found for exchange {exchange}: {e}\")\n                            })?;\n                            self.symbol_venue_map.insert(symbol, venue);\n                            venue\n                        }\n                        _ => *self\n                            .publisher_venue_map\n                            .get(&msg.hd.publisher_id)\n                            .ok_or_else(|| {\n                                anyhow::anyhow!(\n                                    \"Venue not found for publisher_id {}\",\n                                    msg.hd.publisher_id","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/databento/src/loader.rs#L260-L296","documentation":"When decoding Databento DBN definition records in `read_definition_records`, the record header's publisher cannot be resolved (`rec.hd.publisher()` returned an Err). The loader needs the publisher to map each definition to a Nautilus `Venue`; if the header publisher field is invalid or unreadable it aborts with this anyhow error.","triggerScenarios":"Calling `load_instruments` (via `read_definition_records`) on a DBN stream/file whose definition records have a corrupt, zeroed, or unrecognized publisher_id in the record header.","commonSituations":"Manually concatenated DBN files, records produced by a newer databento schema version whose header layout the installed `dbn` crate cannot parse, or truncated/corrupt downloads.","solutions":["Check the publisher_id field of the offending record with `databento` CLI or `dbn` inspect tooling to confirm it is valid","Update the `databento-dbn` crate to the latest version so new publisher schemas are recognized","Re-download the dataset from Databento so the definitions file is not truncated or corrupt","If the file was assembled manually, ensure each record's hd.publisher_id matches a valid Databento publisher"],"exampleFix":"// before\nlet publisher = rec.hd.publisher().map_err(|e| anyhow::anyhow!(\"Invalid `publisher` for record: {e}\"))?;\n// after\nlet publisher = rec.hd.publisher().map_err(|e| anyhow::anyhow!(\"Invalid `publisher` {} for record with raw_symbol {}: {e}\", rec.hd.publisher_id, rec.raw_symbol()))?;","handlingStrategy":"validation","validationCode":"// before loading, sanity-check the first record header\nlet rec = dbn_stream.get().expect(\"stream has records\");\nassert!(rec.hd.publisher_id != 0, \"publisher_id must be set\");\nassert!(rec.hd.publisher().is_ok(), \"publisher header must resolve\");","typeGuard":null,"tryCatchPattern":"match loader.load_instruments(file) {\n    Ok(instruments) => instruments,\n    Err(e) if e.to_string().contains(\"Invalid `publisher`\") => {\n        log::error!(\"corrupt/unrecognized DBN publisher header: {e}; re-download the file\");\n        Vec::new()\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Always download definitions via the official Databento client rather than assembling files manually","Keep the `databento-dbn` crate version aligned with the data schema version","Validate downloaded file sizes/checksums before loading"],"tags":["databento","dbn-decoding","instrument-definitions"],"backgroundTag":"schema-validation-failed","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"}