nautechsystems/nautilus_trader · error
bundled America/New_York timezone
Error message
bundled America/New_York timezone
What it means
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.
Source
Thrown at crates/trading/src/sessions.rs:44
use std::sync::LazyLock;
use jiff::{
Span, Timestamp, Zoned,
civil::{Time, Weekday},
tz::TimeZone,
};
use nautilus_core::datetime::get_timezone;
use strum::{Display, EnumIter, EnumString, FromRepr};
static SYDNEY_TIMEZONE: LazyLock<TimeZone> =
LazyLock::new(|| get_timezone("Australia/Sydney").expect("bundled Australia/Sydney timezone"));
static TOKYO_TIMEZONE: LazyLock<TimeZone> =
LazyLock::new(|| get_timezone("Asia/Tokyo").expect("bundled Asia/Tokyo timezone"));
static LONDON_TIMEZONE: LazyLock<TimeZone> =
LazyLock::new(|| get_timezone("Europe/London").expect("bundled Europe/London timezone"));
static NEW_YORK_TIMEZONE: LazyLock<TimeZone> =
LazyLock::new(|| get_timezone("America/New_York").expect("bundled America/New_York timezone"));
/// Represents a major Forex market session based on trading hours.
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, FromRepr, EnumIter, EnumString, Display)]
#[strum(ascii_case_insensitive)]
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
#[cfg_attr(
feature = "python",
pyo3::pyclass(
eq,
eq_int,
module = "nautilus_trader.trading",
from_py_object,
rename_all = "SCREAMING_SNAKE_CASE"
)
)]
#[cfg_attr(
feature = "python",
pyo3_stub_gen::derive::gen_stub_pyclass_enum(module = "nautilus_trader.trading")View on GitHub (pinned to 18893faf8b)
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.
Example fix
// before (feature-gated tz data off)
chrono-tz = { version = "0.9", optional = true }
// after
chrono-tz = "0.9" # always bundled; America/New_York resolves without OS tzdata Defensive patterns
Strategy: fallback
Validate before calling
fn tzdata_available() -> bool {
std::path::Path::new("/usr/share/zoneinfo/America/New_York").exists()
} Try / catch
// Panics cannot be caught in Rust; gate session usage on a startup check assert!(tzdata_available(), "America/New_York unresolvable: install tzdata or bundle tzdb");
Prevention
- 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.
When it happens
Trigger: First evaluation of `NEW_YORK_TIMEZONE` (New York session start/end helpers) when `get_timezone("America/New_York")` fails to resolve.
Common situations: Slim/minimal container images without tzdata; cross-compiled binaries where bundled tz data was stripped; environments with a broken `TZDIR` or missing zoneinfo files.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- bundled Australia/Sydney timezone
- bundled Asia/Tokyo timezone
- bundled Europe/London timezone
- Latency model should be initialized
- Execution client should be initialized
AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08).
Data as JSON: /api/errors/382dc3e2ee0a12e0.
Report an issue: GitHub.