{"record":{"id":"960d686d5afb4d3d","repo":"nautechsystems/nautilus_trader","slug":"bundled-europe-london-timezone","errorCode":null,"errorMessage":"bundled Europe/London timezone","messagePattern":"bundled Europe/London timezone","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/trading/src/sessions.rs","lineNumber":42,"sourceCode":"//! - London Session    0800-1600 (Europe / London)\n//! - New York Session  0800-1700 (America / New York)\n\nuse std::sync::LazyLock;\n\nuse jiff::{\n    Span, Timestamp, Zoned,\n    civil::{Time, Weekday},\n    tz::TimeZone,\n};\nuse nautilus_core::datetime::get_timezone;\nuse strum::{Display, EnumIter, EnumString, FromRepr};\n\nstatic SYDNEY_TIMEZONE: LazyLock<TimeZone> =\n    LazyLock::new(|| get_timezone(\"Australia/Sydney\").expect(\"bundled Australia/Sydney timezone\"));\nstatic TOKYO_TIMEZONE: LazyLock<TimeZone> =\n    LazyLock::new(|| get_timezone(\"Asia/Tokyo\").expect(\"bundled Asia/Tokyo timezone\"));\nstatic LONDON_TIMEZONE: LazyLock<TimeZone> =\n    LazyLock::new(|| get_timezone(\"Europe/London\").expect(\"bundled Europe/London timezone\"));\nstatic NEW_YORK_TIMEZONE: LazyLock<TimeZone> =\n    LazyLock::new(|| get_timezone(\"America/New_York\").expect(\"bundled America/New_York timezone\"));\n\n/// Represents a major Forex market session based on trading hours.\n#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, FromRepr, EnumIter, EnumString, Display)]\n#[strum(ascii_case_insensitive)]\n#[strum(serialize_all = \"SCREAMING_SNAKE_CASE\")]\n#[cfg_attr(\n    feature = \"python\",\n    pyo3::pyclass(\n        eq,\n        eq_int,\n        module = \"nautilus_trader.trading\",\n        from_py_object,\n        rename_all = \"SCREAMING_SNAKE_CASE\"\n    )\n)]\n#[cfg_attr(","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/trading/src/sessions.rs#L24-L60","documentation":"The London session's `LazyLock` resolves `Europe/London` and panics if the timezone cannot be loaded. Since the identifier is a hard-coded IANA name expected to exist in the bundled database, failure signals a missing or broken timezone data source. It triggers on first use of any London FX session helper.","triggerScenarios":"First evaluation of `LONDON_TIMEZONE` (London session start/end helpers) where `get_timezone(\"Europe/London\")` returns `Err`.","commonSituations":"Containers/alpine images without tzdata; custom builds dropping the bundled tz feature; corrupted or partial `/usr/share/zoneinfo` when system lookup is used.","solutions":["Ensure the bundled timezone database feature is enabled so the name resolves without the OS.","Install tzdata in the deployment environment if the system database is used.","Verify zoneinfo integrity (`zdump -v Europe/London`) when relying on the OS.","Rebuild the project to regenerate embedded tz tables after dependency upgrades."],"exampleFix":"// before\nlet tz = get_timezone(\"Europe/London\").ok()?; // silently drops error elsewhere\n\n// after (application-side guard before using session helpers)\nlet tz = get_timezone(\"Europe/London\")\n    .unwrap_or_else(|e| panic!(","handlingStrategy":"fallback","validationCode":"fn tzdata_available() -> bool {\n    std::path::Path::new(\"/usr/share/zoneinfo/Europe/London\").exists()\n}","typeGuard":null,"tryCatchPattern":"// Panics cannot be caught in Rust; validate at startup\nif !tzdata_available() {\n    panic!(\"Europe/London unresolvable: tzdata missing\");\n}","preventionTips":["Bundle the tz database in the binary rather than relying on the host OS.","Verify zoneinfo presence in your container entrypoint before starting services.","Pin base images and add tzdata to the Dockerfile explicitly."],"tags":["rust","panic","timezone","initialization"],"backgroundTag":"missing-env-var","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"}