{"record":{"id":"943a5f033549f0b9","repo":"nautechsystems/nautilus_trader","slug":"invalid-nautilusdatatype-s","errorCode":null,"errorMessage":"Invalid `NautilusDataType`: '{s}'","messagePattern":"Invalid `NautilusDataType`: '(.+?)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/backtest/src/config.rs","lineNumber":96,"sourceCode":"}\n\nimpl FromStr for NautilusDataType {\n    type Err = anyhow::Error;\n\n    fn from_str(s: &str) -> anyhow::Result<Self> {\n        match s {\n            stringify!(QuoteTick) => Ok(Self::QuoteTick),\n            stringify!(TradeTick) => Ok(Self::TradeTick),\n            stringify!(Bar) => Ok(Self::Bar),\n            stringify!(OrderBookDelta) => Ok(Self::OrderBookDelta),\n            stringify!(OrderBookDepth10) => Ok(Self::OrderBookDepth10),\n            stringify!(MarkPriceUpdate) => Ok(Self::MarkPriceUpdate),\n            stringify!(IndexPriceUpdate) => Ok(Self::IndexPriceUpdate),\n            stringify!(FundingRateUpdate) => Ok(Self::FundingRateUpdate),\n            stringify!(InstrumentStatus) => Ok(Self::InstrumentStatus),\n            stringify!(OptionGreeks) => Ok(Self::OptionGreeks),\n            stringify!(InstrumentClose) => Ok(Self::InstrumentClose),\n            _ => anyhow::bail!(\"Invalid `NautilusDataType`: '{s}'\"),\n        }\n    }\n}\n\n/// Configuration for ``BacktestEngine`` instances.\n#[cfg_attr(\n    feature = \"python\",\n    pyo3::pyclass(module = \"nautilus_trader.backtest\", from_py_object, unsendable)\n)]\n#[cfg_attr(\n    feature = \"python\",\n    pyo3_stub_gen::derive::gen_stub_pyclass(module = \"nautilus_trader.backtest\")\n)]\n#[expect(\n    clippy::struct_excessive_bools,\n    reason = \"config fields mirror the existing Rust and Python backtest engine surfaces\"\n)]\n#[derive(Debug, Clone, bon::Builder)]","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/backtest/src/config.rs#L78-L114","documentation":"NautilusDataType implements FromStr so config values given as strings (e.g. from TOML/CLI) can be parsed into the enum. This error is thrown when the string does not exactly match any variant name — parsing is case-sensitive and uses the Rust variant identifiers (e.g. \"TradeTick\", not \"trade_tick\" or \"TradeTicks\").","triggerScenarios":"Parsing a NautilusDataType from a string in a backtest config where the value is misspelled, wrongly cased, or uses snake_case (e.g. \"quote_tick\" instead of \"QuoteTick\").","commonSituations":"Hand-editing a TOML/JSON backtest config; porting configs from Python (snake_case) into Rust; typo like \"TradeTick \" with whitespace or \"quote\" abbreviation.","solutions":["Use the exact variant name with correct casing, e.g. \"TradeTick\", \"QuoteTick\", \"OrderBookDeltas\"","Check the enum definition in crates/backtest/src/config.rs for valid variant names","Strip whitespace and fix casing in the config source","If migrating from Python configs, convert snake_case values to PascalCase variant names"],"exampleFix":"// before\nlet dt: NautilusDataType = \"trade_tick\".parse()?;  // invalid\n// after\nlet dt: NautilusDataType = \"TradeTick\".parse()?;","handlingStrategy":"validation","validationCode":"const VALID: &[&str] = &[\"TradeTick\",\"QuoteTick\",\"OrderBookDeltas\",\"OrderBookDepth10\",\"OrderBookDeltas1s\",\"InstrumentClose\",\"MarkPriceUpdate\",\"IndexPriceUpdate\",\"FundingRateUpdate\",\"InstrumentStatus\",\"OptionGreeks\"];\nfn valid_dtype(s: &str) -> Result<NautilusDataType, String> {\n    s.trim().parse::<NautilusDataType>()\n        .map_err(|_| format!(\"'{s}' is not a NautilusDataType variant; try PascalCase like 'TradeTick'\"))\n}","typeGuard":null,"tryCatchPattern":"let dt = \"trade_tick\".parse::<NautilusDataType>()\n    .map_err(|e| anyhow::anyhow!(\"bad backtest config data_type: {e}; use PascalCase variant names\"))?;","preventionTips":["Use exact PascalCase variant names in configs","Strip whitespace from config strings before parsing","Keep a canonical config sample with valid enum values"],"tags":["enum","parsing","config","backtest"],"backgroundTag":"invalid-enum-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}