{"record":{"id":"e7e52d742dcab1b4","repo":"nautechsystems/nautilus_trader","slug":"bundled-asia-tokyo-timezone","errorCode":null,"errorMessage":"bundled Asia/Tokyo timezone","messagePattern":"bundled Asia/Tokyo timezone","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/trading/src/sessions.rs","lineNumber":40,"sourceCode":"//! - Sydney Session    0700-1600 (Australia / Sydney)\n//! - Tokyo Session     0900-1800 (Asia / Tokyo)\n//! - 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    )","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/trading/src/sessions.rs#L22-L58","documentation":"Identical to the Sydney case: the Tokyo session's `LazyLock` resolves `Asia/Tokyo` via `get_timezone` and panics on failure. The library assumes the tz database is available (bundled at build time), so an error indicates the timezone lookup layer is misconfigured. It fires the first time any Tokyo FX session boundary is computed.","triggerScenarios":"First call touching `TOKYO_TIMEZONE` (Tokyo session start/end/boundary helpers) when `get_timezone(\"Asia/Tokyo\")` cannot resolve the IANA name.","commonSituations":"Minimal Docker images without tzdata; builds where the bundled chrono-tz tables were feature-gated out; environments whose `TZDIR` points at an incomplete zoneinfo directory.","solutions":["Enable the bundled timezone database (chrono-tz / tzdb feature) in the datetime dependency.","Install tzdata in the runtime image (`apt-get install tzdata` / `apk add tzdata`).","Check `TZDIR`/zoneinfo configuration if the resolver reads the system database.","Rebuild after dependency or feature changes so bundled tz data is embedded."],"exampleFix":"// before (Dockerfile)\nFROM scratch\nCOPY target/release/app /\n\n// after\nFROM debian:bookworm-slim\nRUN apt-get update && apt-get install -y tzdata && rm -rf /var/lib/apt/lists/*\nCOPY target/release/app /","handlingStrategy":"fallback","validationCode":"fn tzdata_available() -> bool {\n    std::path::Path::new(\"/usr/share/zoneinfo/Asia/Tokyo\").exists()\n}","typeGuard":null,"tryCatchPattern":"// Panics cannot be caught in Rust; fail fast at startup instead\nassert!(tzdata_available(), \"Asia/Tokyo unresolvable: install tzdata or enable bundled tzdb\");","preventionTips":["Install tzdata in every runtime image your binary ships to.","Enable chrono-tz / bundled tzdb features so IANA resolution never touches the OS.","Smoke-test timezone resolution in CI for all session zones."],"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"}