GoogleContainerTools/skaffold · error
bad timezone provided: %q, error: %s
Error message
bad timezone provided: %q, error: %s
What it means
The date/time Tagger formats the current time in a configured IANA time zone. Before formatting it calls time.LoadLocation on the configured TimeZone; if Go cannot resolve that string to a known location (e.g. an invalid name, or no tzdata available on the system), it returns this error instead of a tag.
Source
Thrown at pkg/skaffold/tag/date_time.go:60
timeFn: time.Now,
}
}
// GenerateTag generates a tag using the current timestamp.
func (t *dateTimeTagger) GenerateTag(ctx context.Context, image latest.Artifact) (string, error) {
format := tagTime
if len(t.Format) > 0 {
format = t.Format
}
timezone := "Local"
if len(t.TimeZone) > 0 {
timezone = t.TimeZone
}
loc, err := time.LoadLocation(timezone)
if err != nil {
return "", fmt.Errorf("bad timezone provided: %q, error: %s", timezone, err)
}
return t.timeFn().In(loc).Format(format), nil
}
View on GitHub (pinned to a1189de023)
Solutions
- Set timeZone to a valid IANA name (check `timedatectl` or the IANA list), e.g. 'UTC' or 'America/New_York'
- Install tzdata in the build/run image (apk add tzdata / apt-get install tzdata) so LoadLocation can resolve names
- Import _ 'time/tzdata' in the binary to embed the zone database when building scratch/distroless images
- Remove the timeZone field to fall back to the default local time
Example fix
// before
{
"tagger": { "date_Time": { "format": "2006-01-02", "timeZone": "utc+2" } }
}
// after
{
"tagger": { "date_Time": { "format": "2006-01-02", "timeZone": "UTC" } }
} Defensive patterns
Strategy: validation
Validate before calling
if _, err := time.LoadLocation(cfg.Tagger.DateTime.TimeZone); err != nil {
return fmt.Errorf("invalid tagger timeZone %q: %w", cfg.Tagger.DateTime.TimeZone, err)
} Type guard
func isValidTimeZone(tz string) bool {
if tz == "" || tz == "Local" { return true }
_, err := time.LoadLocation(tz)
return err == nil
} Prevention
- Only use IANA zone names like UTC or Europe/Berlin in skaffold.yaml
- Install tzdata in build/CI images
- Import _ "time/tzdata" for scratch/distroless binaries
- Add a config lint step validating timeZone before builds
When it happens
Trigger: skaffold.yaml sets tagger.date_Time.timeZone to a string that time.LoadLocation cannot resolve — a typo like 'utc', a wrong case, a full path with missing zoneinfo database, or a non-IANA alias. Also occurs on minimal/stripped Docker images (alpine, scratch) that lack /usr/share/zoneinfo and where the binary was not built with the embedded tzdata import.
Common situations: Deploying builds inside slim containers without the tzdata package; copying a timeZone value from another tool that expects a POSIX TZ string or a UTC offset like '+02:00' instead of an IANA name like 'Europe/Berlin'; typos after editing skaffold.yaml.
Related errors
- parsing template: %w
- %q is not a valid git tagger variant
- environment variables missing for template keys
- unable to find git commit: %w
- getting git status: %w
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/6b087bc16fcc2481.
Report an issue: GitHub.