{"record":{"id":"889acfe3c40633ff","repo":"nautechsystems/nautilus_trader","slug":"unknown-data-type-type-name","errorCode":null,"errorMessage":"Unknown data type: {type_name}","messagePattern":"Unknown data type: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/persistence/src/backend/custom.rs","lineNumber":218,"sourceCode":"        \"MarkPriceUpdate\" | \"mark_price_updates\" => {\n            Ok(MarkPriceUpdate::decode_data_batch(metadata, batch)?)\n        }\n        \"IndexPriceUpdate\" | \"index_price_updates\" => {\n            Ok(IndexPriceUpdate::decode_data_batch(metadata, batch)?)\n        }\n        \"OptionGreeks\" | \"option_greeks\" => Ok(OptionGreeks::decode_data_batch(metadata, batch)?),\n        \"InstrumentClose\" | \"instrument_closes\" => {\n            Ok(InstrumentClose::decode_data_batch(metadata, batch)?)\n        }\n        _ => {\n            if allow_custom_fallback {\n                #[cfg(feature = \"python\")]\n                {\n                    return Ok(CustomDataDecoder::decode_data_batch(metadata, batch)?);\n                }\n                #[cfg(not(feature = \"python\"))]\n                {\n                    anyhow::bail!(\"Unknown data type: {type_name}\");\n                }\n            }\n            anyhow::bail!(\n                \"Unknown data type: {type_name}; custom decode only allowed in custom data context\"\n            )\n        }\n    }\n}\n\n/// Decodes multiple `RecordBatches` (e.g. from custom data files) into a single `Vec<Data>`.\n/// Optionally replaces `ts_init` column with `ts_event` before decoding each batch.\n///\n/// # Errors\n///\n/// Returns an error if any batch fails to decode.\npub fn decode_custom_batches_to_data(\n    batches: Vec<RecordBatch>,\n    use_ts_event_for_ts_init: bool,","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/persistence/src/backend/custom.rs#L200-L236","documentation":"decode_batch_to_data dispatches on the record's type name. When the type is not a built-in type decodable natively and the 'python' feature is disabled, there is no registered decoder for the type, so decoding fails with 'Unknown data type'. Custom data decoding via Python is only available with the python feature enabled.","triggerScenarios":"Reading a catalog containing custom/unknown data types from a Rust build compiled without the 'python' feature (e.g. a pure-Rust binary reading data written from Python-defined custom types), or a genuinely misspelled/unknown type name.","commonSituations":"A Rust-only deployment consuming a catalog produced by nautilus_trader Python with custom data classes; mixing builds with different feature flags; reading catalogs from newer versions with types unknown to the reader.","solutions":["Rebuild with the 'python' feature enabled (cargo build --features python) so Python-backed decoders are available.","Filter out or skip unknown data types when querying the catalog.","Verify the type_name matches a type registered/known in this build; align versions between writer and reader.","Convert the data with a Python-enabled build first, or re-export the data in a built-in supported type."],"exampleFix":"// before — pure Rust build reading Python-written custom data\nlet data = catalog.query(...)?; // bails: Unknown data type: custom/MySignal\n// after — enable the feature in Cargo.toml\n[dependencies.nautilus-persistence]\nfeatures = [\"python\"]","handlingStrategy":"fallback","validationCode":"// build-time guard in Cargo.toml\n// [features] ensure 'python' is enabled when the catalog may contain Python custom data\nfn can_decode(type_name: &str, python_enabled: bool) -> bool {\n    is_builtin_type(type_name) || (python_enabled && is_registered_custom_type(type_name))\n}","typeGuard":null,"tryCatchPattern":"match decode_custom_batches_to_data(batches) {\n    Err(e) if e.to_string().contains(\"Unknown data type\") => {\n        // skip this batch/type or switch to a python-feature-enabled build\n    }\n    other => other?,\n}","preventionTips":["Enable the 'python' feature if catalogs may contain Python-defined custom data.","Skip/filter unknown data types when querying across mixed-version catalogs.","Keep writer and reader builds (and custom type registrations) in sync."],"tags":["rust","persistence","feature-flags","decoding","custom-data"],"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-14T05:17:10.506Z"}