Netflix/chaosmonkey · error
deploySchedule: could not retrieve local timezone: %v
Error message
deploySchedule: could not retrieve local timezone: %v
What it means
deploySchedule needs the monkey's configured local timezone (cfg.Location(), typically backed by a time.LoadLocation call) to compute 'today' before publishing the schedule. If the timezone cannot be loaded, the schedule is not published and this error is returned. It almost always means the host lacks timezone data or TZ_NAME/TZ is set to an unknown zone.
Source
Thrown at command/schedule.go:83
}
// Filter out terminations that violate constrains
sched := cons.Filter(*s)
err = deploySchedule(&sched, ss, cfg)
if err != nil {
return fmt.Errorf("failed to deploy schedule: %v", err)
}
return nil
}
// deploySchedule publishes the schedule to chaosmonkey-api
// and registers the schedule with the local cron
func deploySchedule(s *schedule.Schedule, ss schedstore.SchedStore, cfg *config.Monkey) error {
loc, err := cfg.Location()
if err != nil {
return fmt.Errorf("deploySchedule: could not retrieve local timezone: %v", err)
}
today := time.Now().In(loc)
err = ss.Publish(today, s)
if err != nil {
return fmt.Errorf("deploySchedule: could not publish schedule: %v", err)
}
err = registerWithCron(s, cfg)
return err
}
// registerWithCron registers the schedule of terminations with cron on the local machine
//
// Creates or overwrites the file specified by config.Chaos.CronPath()
func registerWithCron(s *schedule.Schedule, cfg *config.Monkey) error {View on GitHub (pinned to eaa28fb761)
Solutions
- Install the tzdata package in the runtime image (apt-get install tzdata or add tzdata to the Go binary's environment / use an import of tzdata).
- Fix the TZ environment variable or the configured location name to a valid IANA zone (e.g. America/Los_Angeles).
- Check the wrapped %v cause for the exact zone name that failed to load.
Example fix
// before (Dockerfile) FROM scratch // after FROM alpine RUN apk add --no-cache tzdata ENV TZ=America/Los_Angeles
Defensive patterns
Strategy: validation
Validate before calling
// verify the local timezone resolves before invoking the schedule command
locName := os.Getenv("TZ")
if locName == "" {
locName = "Local"
}
if _, err := time.LoadLocation(locName); err != nil {
return fmt.Errorf("invalid or missing timezone %q: %v (install tzdata)", locName, err)
} Try / catch
if err := do(dep, appCfgGetter, schedStore, cfg, constrainer, apps); err != nil {
if strings.Contains(err.Error(), "could not retrieve local timezone") {
log.Error("tzdata missing or TZ invalid; install tzdata or set TZ to a valid IANA zone")
return err
}
return err
} Prevention
- Install tzdata in container images (or import _ "time/tzdata" in Go 1.15+).
- Set TZ to a valid IANA zone name and validate it at startup.
- Test config.Location() in a smoke check before scheduling runs.
- Avoid nonstandard zone names; use the IANA database spellings.
When it happens
Trigger: deploySchedule (invoked via the schedule command) when cfg.Location() returns an error, e.g. time.LoadLocation(name) with an invalid zone name or a runtime environment without the IANA tz database.
Common situations: Minimal Docker images (scratch/alpine without tzdata), TZ set to a misspelled zone like 'America/San_Francisco', or a config key specifying a nonexistent location.
Related errors
- FATAL: no spinnaker endpoint specified in config
- failed to populate schedule: %v
- failed to deploy schedule: %v
- failed to read config file
- failed to parse config
AI-assisted analysis of Netflix/chaosmonkey@eaa28fb761 (2026-09-03).
Data as JSON: /api/errors/308f2ecedd4d6f39.
Report an issue: GitHub.