nautechsystems/nautilus_trader · error
bundled Australia/Sydney timezone
Error message
bundled Australia/Sydney timezone
What it means
The Sydney FX session lazily loads the `Australia/Sydney` IANA timezone and panics if it cannot be resolved. The library expects the tz database to be bundled/compiled in (nautilus_core::datetime::get_timezone), so failure means the build or environment lost the bundled timezone data. This is an internal invariant: the identifier is a compile-time constant, so it should always resolve.
Source
Thrown at crates/trading/src/sessions.rs:38
//! All FX sessions run Monday to Friday local time:
//!
//! - Sydney Session 0700-1600 (Australia / Sydney)
//! - Tokyo Session 0900-1800 (Asia / Tokyo)
//! - London Session 0800-1600 (Europe / London)
//! - New York Session 0800-1700 (America / New York)
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,View on GitHub (pinned to 18893faf8b)
Solutions
- Verify the tz-database feature of the datetime dependency is enabled so IANA names resolve from bundled data.
- Install/repair the system tzdata package (tzdata / tzdata пакеты) if the lookup falls back to the OS database.
- Confirm the timezone string is exactly `Australia/Sydney` (it is a static constant, so this mainly guards against local edits).
- Rebuild the crate after dependency changes so the bundled timezone tables are regenerated.
Example fix
// before (Cargo.toml — bundled tz data disabled)
chrono = { version = "0.4", default-features = false }
// after
chrono = { version = "0.4", features = ["clock"] }
chrono-tz = "0.9" # ensures IANA names like Australia/Sydney resolve at runtime Defensive patterns
Strategy: fallback
Validate before calling
// Check the environment before using FX session helpers
fn tzdata_available() -> bool {
std::path::Path::new("/usr/share/zoneinfo/Australia/Sydney").exists()
} Try / catch
// Rust: expect panics — cannot catch; pre-flight the environment instead
if !tzdata_available() {
eprintln!("tzdata missing: FX session helpers will panic");
std::process::exit(1);
} Prevention
- Use Docker base images that include tzdata (debian-slim, alpine + `apk add tzdata`).
- Prefer builds with the bundled timezone database so no runtime tzdata is needed.
- Add a startup smoke test that resolves all four session timezones before entering the trading loop.
When it happens
Trigger: First use of the Sydney session constants (e.g. `ForexSession::Sydney` boundary helpers) triggering the `LazyLock`, when `get_timezone("Australia/Sydney")` returns `Err` — typically because the tz database is missing from the binary or the runtime lookup failed.
Common situations: Running on a stripped container/minimal OS without tzdata when the crate is configured to load from the system database instead of a bundled one; a dependency change that altered `get_timezone` behavior; cross-compiled builds where the bundled chrono-tz data was dropped by a feature flag.
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 Asia/Tokyo timezone
- bundled Europe/London timezone
- bundled America/New_York 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/8d6bf646f4666f00.
Report an issue: GitHub.