{"record":{"id":"f1493deee8a10be2","repo":"nautechsystems/nautilus_trader","slug":"invalid-book-snapshot-output-book-snapshot-outp","errorCode":null,"errorMessage":"Invalid book_snapshot_output: '{book_snapshot_output}'. Expected 'depth10' or 'deltas'","messagePattern":"Invalid book_snapshot_output: '(.+?)'\\. Expected 'depth10' or 'deltas'","errorType":"validation","errorClass":"PyRuntimeError","httpStatus":null,"severity":"error","filePath":"crates/adapters/tardis/src/python/machine.rs","lineNumber":106,"sourceCode":"    /// Provides a client for connecting to a [Tardis Machine Server](https://docs.tardis.dev/api/tardis-machine).\n    #[new]\n    #[pyo3(signature = (\n        base_url = None,\n        normalize_symbols = true,\n        book_snapshot_output = \"deltas\",\n        extract_bbo_as_quotes = false,\n    ))]\n    fn py_new(\n        base_url: Option<&str>,\n        normalize_symbols: bool,\n        book_snapshot_output: &str,\n        extract_bbo_as_quotes: bool,\n    ) -> PyResult<Self> {\n        let output = match book_snapshot_output {\n            \"depth10\" => BookSnapshotOutput::Depth10,\n            \"deltas\" => BookSnapshotOutput::Deltas,\n            _ => {\n                return Err(to_pyruntime_err(anyhow::anyhow!(\n                    \"Invalid book_snapshot_output: '{book_snapshot_output}'. Expected 'depth10' or 'deltas'\"\n                )));\n            }\n        };\n        let mut client =\n            Self::new(base_url, normalize_symbols, output).map_err(to_pyruntime_err)?;\n        client.extract_bbo_as_quotes = extract_bbo_as_quotes;\n        Ok(client)\n    }\n\n    /// Returns `true` if `close()` has been called.\n    ///\n    /// This checks that both replay and stream signals have been set,\n    /// which only occurs when `close()` is explicitly called.\n    #[pyo3(name = \"is_closed\")]\n    #[must_use]\n    pub fn py_is_closed(&self) -> bool {\n        self.is_closed()","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/tardis/src/python/machine.rs#L88-L124","documentation":"The Python wrapper for the Tardis machine client validates the book_snapshot_output constructor argument. Only the strings 'depth10' and 'deltas' are accepted; anything else is rejected at construction time with a Python RuntimeError wrapping this anyhow error.","triggerScenarios":"Instantiating the TardisMachine pyclass with book_snapshot_output set to any string other than 'depth10' or 'deltas' (typos like 'depth', 'Depth10', 'raw', or empty string).","commonSituations":"Typo in the config passed from a Nautilus Node/PyO3 caller; copying an example that used an older allowed value; programmatically interpolating an enum value with different casing.","solutions":["Pass exactly 'depth10' or 'deltas' (lowercase) as book_snapshot_output.","Check the value your config file or environment supplies for book_snapshot_output and fix the typo/casing.","If you need a different output mode, extend the match in crates/adapters/tardis/src/python/machine.rs py_new to a new BookSnapshotOutput variant."],"exampleFix":"// before\nmachine = TardisMachine(base_url, normalize_symbols, \"depth\", extract_bbo_as_quotes)\n// after\nmachine = TardisMachine(base_url, normalize_symbols, \"depth10\", extract_bbo_as_quotes)","handlingStrategy":"validation","validationCode":"VALID_OUTPUTS = {\"depth10\", \"deltas\"}\nif book_snapshot_output not in VALID_OUTPUTS:\n    raise ValueError(f\"book_snapshot_output must be one of {VALID_OUTPUTS}, got {book_snapshot_output!r}\")","typeGuard":"def is_valid_book_output(v: str) -> bool:\n    return v in (\"depth10\", \"deltas\")","tryCatchPattern":"try:\n    machine = TardisMachine(base_url, normalize_symbols, book_snapshot_output, extract_bbo)\nexcept RuntimeError as e:\n    if \"Invalid book_snapshot_output\" in str(e):\n        book_snapshot_output = \"deltas\"\n        machine = TardisMachine(base_url, normalize_symbols, book_snapshot_output, extract_bbo)","preventionTips":["Define the allowed values as a constant/enum in your node config and validate config at load time.","Never pass user-supplied strings straight into the constructor without normalization (lowercase, strip).","Keep constructor args in a small factory function that centralizes validation."],"tags":["rust","python","pyo3","tardis","invalid-enum"],"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"}