{"record":{"id":"ac7addd3cbef9e52","repo":"glanceapp/glance","slug":"invalid-timezone-s-v","errorCode":null,"errorMessage":"invalid timezone '%s': %v","messagePattern":"invalid timezone '(.+?)': (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/glance/widget-clock.go","lineNumber":37,"sourceCode":"\t} `yaml:\"timezones\"`\n}\n\nfunc (widget *clockWidget) initialize() error {\n\twidget.withTitle(\"Clock\").withError(nil)\n\n\tif widget.HourFormat == \"\" {\n\t\twidget.HourFormat = \"24h\"\n\t} else if widget.HourFormat != \"12h\" && widget.HourFormat != \"24h\" {\n\t\treturn errors.New(\"hour-format must be either 12h or 24h\")\n\t}\n\n\tfor t := range widget.Timezones {\n\t\tif widget.Timezones[t].Timezone == \"\" {\n\t\t\treturn errors.New(\"missing timezone value\")\n\t\t}\n\n\t\tif _, err := time.LoadLocation(widget.Timezones[t].Timezone); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid timezone '%s': %v\", widget.Timezones[t].Timezone, err)\n\t\t}\n\t}\n\n\twidget.cachedHTML = widget.renderTemplate(widget, clockWidgetTemplate)\n\n\treturn nil\n}\n\nfunc (widget *clockWidget) Render() template.HTML {\n\treturn widget.cachedHTML\n}\n","sourceCodeStart":19,"sourceCodeEnd":49,"githubUrl":"https://github.com/glanceapp/glance/blob/91324e8de762702e97b0ac5c8e36271d644d8642/internal/glance/widget-clock.go#L19-L49","documentation":"Returned by the clock widget's Initialize when time.LoadLocation rejects one of the configured timezone strings. LoadLocation resolves names against the IANA Time Zone database and fails on misspelled names, non-IANA names, or when no tz database is available in the binary/container.","triggerScenarios":"timezones: [{timezone: \"EST\"}] (deprecated abbreviation, not a valid IANA name), \"New_York\" without the region prefix, \"GMT+2\" style, or a valid name like \"Europe/Berlin\" inside a scratch/distroless Docker image lacking /usr/share/zoneinfo.","commonSituations":"Users copy abbreviations (PST, CEST) instead of IANA names; glance deployed in a minimal container without tzdata; typo in YAML; Alpine-based image without the tzdata package.","solutions":["Use full IANA names: America/New_York, Europe/Berlin, Asia/Kolkata, UTC.","If running in a minimal container, install tzdata (apk add tzdata / apt-get install tzdata) or blank-import time/tzdata.","Validate each entry with `go run` one-liner time.LoadLocation or a site like zoneinfo before adding to config.","Remember hour-format must also be 12h or 24h — a bad value raises a separate error in the same function."],"exampleFix":"# before\ntimezones:\n  - timezone: PST\n\n# after\ntimezones:\n  - timezone: America/Los_Angeles\n\n# main.go (container without zoneinfo)\nimport _ \"time/tzdata\"","handlingStrategy":"validation","validationCode":"func validTimezones(ts []clockTimezone) error {\n    for _, t := range ts {\n        if t.Timezone == \"\" {\n            return errors.New(\"missing timezone value\")\n        }\n        if _, err := time.LoadLocation(t.Timezone); err != nil {\n            return fmt.Errorf(\"invalid timezone %q: use IANA names like Europe/Berlin\", t.Timezone)\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if _, err := time.LoadLocation(tz); err != nil {\n    slog.Warn(\"falling back to UTC\", \"timezone\", tz, \"error\", err)\n    tz = \"UTC\"\n}","preventionTips":["Use IANA zone names only (America/New_York, not EST/NY).","In minimal containers, install tzdata or blank-import _ \"time/tzdata\".","Lint config at deploy time by running LoadLocation over every timezone value."],"tags":["config","timezone","clock-widget","container"],"backgroundTag":null,"analyzedSha":"91324e8de762702e97b0ac5c8e36271d644d8642","analyzedAt":"2026-08-15T14:12:54.279Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}