{"id":"87176f524deb8a2f","repo":"gohugoio/hugo","slug":"failed-to-parse-clock-s","errorCode":null,"errorMessage":"failed to parse clock: %s","messagePattern":"failed to parse clock: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/allconfig/allconfig.go","lineNumber":393,"sourceCode":"\t\t\t\treturn fmt.Errorf(\"failed to compile ignoreFiles pattern %q: %s\", pattern, err)\n\t\t\t}\n\t\t}\n\t\tignoreFile = func(s string) bool {\n\t\t\tfor _, r := range regexps {\n\t\t\t\tif r.MatchString(s) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false\n\t\t}\n\t}\n\n\tvar clock time.Time\n\tif c.Internal.Clock != \"\" {\n\t\tvar err error\n\t\tclock, err = time.Parse(time.RFC3339, c.Internal.Clock)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to parse clock: %s\", err)\n\t\t}\n\t}\n\n\thttpCache, err := c.HTTPCache.Compile()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Legacy language values.\n\tif c.LanguageCode != \"\" {\n\t\tif !c.isLanguageClone {\n\t\t\thugo.DeprecateWithLogger(\"project config key languageCode\", \"Use locale instead.\", \"v0.158.0\", logger.Logger())\n\t\t}\n\t\tif c.Locale == \"\" {\n\t\t\tc.Locale = c.LanguageCode\n\t\t}\n\t\tc.LanguageCode = \"\"\n\t}","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/config/allconfig/allconfig.go#L375-L411","documentation":"Hugo's `clock` setting (internal config, set via the `--clock` CLI flag) freezes the build's notion of \"now\" for testing time-dependent features like future-dated content. The value must parse as RFC 3339; anything else fails config compilation with this error.","triggerScenarios":"Running `hugo --clock 2026-07-31` or setting the clock to any non-RFC3339 string — missing time portion, missing timezone offset, or a locale-style date like `07/31/2026`.","commonSituations":"Users passing date-only values to `--clock` in CI to test publish dates, or omitting the `Z`/offset suffix; RFC 3339 requires the full `2026-07-31T15:00:00Z` shape.","solutions":["Use full RFC 3339 format: `hugo --clock 2026-07-31T00:00:00Z`.","Include a timezone offset if not UTC: `2026-07-31T00:00:00-05:00`.","Drop the flag entirely if you just want the real current time."],"exampleFix":"# before\nhugo --clock 2026-07-31\n# after\nhugo --clock 2026-07-31T00:00:00Z","handlingStrategy":"validation","validationCode":"if clockStr != \"\" {\n    if _, err := time.Parse(time.RFC3339, clockStr); err != nil {\n        return fmt.Errorf(\"clock %q must be RFC3339, e.g. 2026-07-31T00:00:00Z\", clockStr)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use full RFC3339 timestamps (with timezone) for the clock setting / --clock flag","Validate the value with time.Parse before passing it through","Don't pass bare dates like \"2026-07-31\" without checking the accepted layout"],"tags":["hugo","config","time-parsing","cli"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}