{"record":{"id":"382dc3e2ee0a12e0","repo":"nautechsystems/nautilus_trader","slug":"bundled-america-new-york-timezone-382dc3","errorCode":null,"errorMessage":"bundled America/New_York timezone","messagePattern":"bundled America/New_York timezone","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/trading/src/sessions.rs","lineNumber":44,"sourceCode":"\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(\n    feature = \"python\",\n    pyo3_stub_gen::derive::gen_stub_pyclass_enum(module = \"nautilus_trader.trading\")","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/trading/src/sessions.rs#L26-L62","documentation":"The New York session's `LazyLock` resolves `America/New_York` and panics if the timezone cannot be loaded. The library treats the bundled tz database as an invariant, so this panic means the timezone resolution layer is unavailable. It fires the first time any New York FX session boundary is computed.","triggerScenarios":"First evaluation of `NEW_YORK_TIMEZONE` (New York session start/end helpers) when `get_timezone(\"America/New_York\")` fails to resolve.","commonSituations":"Slim/minimal container images without tzdata; cross-compiled binaries where bundled tz data was stripped; environments with a broken `TZDIR` or missing zoneinfo files.","solutions":["Enable the bundled timezone database (e.g. chrono-tz) so IANA names resolve in-binary.","Install tzdata in the runtime environment if the OS database is consulted.","Fix `TZDIR`/zoneinfo paths if customized.","Rebuild so the embedded tz tables include America/New_York."],"exampleFix":"// before (feature-gated tz data off)\nchrono-tz = { version = \"0.9\", optional = true }\n\n// after\nchrono-tz = \"0.9\"  # always bundled; America/New_York resolves without OS tzdata","handlingStrategy":"fallback","validationCode":"fn tzdata_available() -> bool {\n    std::path::Path::new(\"/usr/share/zoneinfo/America/New_York\").exists()\n}","typeGuard":null,"tryCatchPattern":"// Panics cannot be caught in Rust; gate session usage on a startup check\nassert!(tzdata_available(), \"America/New_York unresolvable: install tzdata or bundle tzdb\");","preventionTips":["Ensure the deployment image contains America/New_York in zoneinfo (common omission in slim images).","Use bundled timezone data features so resolution is build-time, not runtime.","Run an integration test that computes one session boundary per zone before release."],"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-14T00:17:10.932Z"}