{"record":{"id":"308f2ecedd4d6f39","repo":"Netflix/chaosmonkey","slug":"deployschedule-could-not-retrieve-local-timezone","errorCode":null,"errorMessage":"deploySchedule: could not retrieve local timezone: %v","messagePattern":"deploySchedule: could not retrieve local timezone: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/schedule.go","lineNumber":83,"sourceCode":"\t}\n\n\t// Filter out terminations that violate constrains\n\tsched := cons.Filter(*s)\n\n\terr = deploySchedule(&sched, ss, cfg)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to deploy schedule: %v\", err)\n\t}\n\n\treturn nil\n}\n\n// deploySchedule publishes the schedule to chaosmonkey-api\n// and registers the schedule with the local cron\nfunc deploySchedule(s *schedule.Schedule, ss schedstore.SchedStore, cfg *config.Monkey) error {\n\tloc, err := cfg.Location()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"deploySchedule: could not retrieve local timezone: %v\", err)\n\t}\n\n\ttoday := time.Now().In(loc)\n\n\terr = ss.Publish(today, s)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"deploySchedule: could not publish schedule: %v\", err)\n\t}\n\n\terr = registerWithCron(s, cfg)\n\treturn err\n}\n\n// registerWithCron registers the schedule of terminations with cron on the local machine\n//\n// Creates or overwrites the file specified by config.Chaos.CronPath()\nfunc registerWithCron(s *schedule.Schedule, cfg *config.Monkey) error {","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/Netflix/chaosmonkey/blob/eaa28fb761c0ebe8644d1333e5d164e9cc3071e9/command/schedule.go#L65-L101","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (Dockerfile)\nFROM scratch\n// after\nFROM alpine\nRUN apk add --no-cache tzdata\nENV TZ=America/Los_Angeles","handlingStrategy":"validation","validationCode":"// verify the local timezone resolves before invoking the schedule command\nlocName := os.Getenv(\"TZ\")\nif locName == \"\" {\n    locName = \"Local\"\n}\nif _, err := time.LoadLocation(locName); err != nil {\n    return fmt.Errorf(\"invalid or missing timezone %q: %v (install tzdata)\", locName, err)\n}","typeGuard":null,"tryCatchPattern":"if err := do(dep, appCfgGetter, schedStore, cfg, constrainer, apps); err != nil {\n    if strings.Contains(err.Error(), \"could not retrieve local timezone\") {\n        log.Error(\"tzdata missing or TZ invalid; install tzdata or set TZ to a valid IANA zone\")\n        return err\n    }\n    return err\n}","preventionTips":["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."],"tags":["timezone","config","deployment"],"backgroundTag":"unknown-timezone","analyzedSha":"eaa28fb761c0ebe8644d1333e5d164e9cc3071e9","analyzedAt":"2026-09-03T17:04:39.020Z","contentChangedAt":"2026-09-03T17:04:39.020Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}