{"id":"3ba31ac4a9d45fc4","repo":"gohugoio/hugo","slug":"the-q-front-matter-field-is-not-a-parsable-date","errorCode":null,"errorMessage":"the %q front matter field is not a parsable date: see %s","messagePattern":"the %q front matter field is not a parsable date: see (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"resources/page/pagemeta/page_frontmatter.go","lineNumber":1034,"sourceCode":"\t\tif found {\n\t\t\td.PageConfigLate.Params[key] = v\n\t\t} else {\n\t\t\t// Reentry from previous handlers.\n\t\t\tv, found = d.PageConfigLate.Params[key]\n\t\t}\n\n\t\tif !found || v == \"\" || v == nil {\n\t\t\treturn false, nil\n\t\t}\n\n\t\tvar date time.Time\n\t\tif vt, ok := v.(time.Time); ok && vt.Location() == d.Location {\n\t\t\tdate = vt\n\t\t} else {\n\t\t\tvar err error\n\t\t\tdate, err = htime.ToTimeInDefaultLocationE(v, d.Location)\n\t\t\tif err != nil {\n\t\t\t\treturn false, fmt.Errorf(\"the %q front matter field is not a parsable date: see %s\", key, d.PathOrTitle)\n\t\t\t}\n\t\t\td.PageConfigLate.Params[key] = date\n\t\t}\n\n\t\t// We map several date keys to one, so, for example,\n\t\t// \"expirydate\", \"unpublishdate\" will all set .ExpiryDate (first found).\n\t\tsetter(d, date)\n\n\t\treturn true, nil\n\t}\n}\n\nfunc (f *frontmatterFieldHandlers) newDateFilenameHandler(setter func(d *FrontMatterDescriptor, t time.Time)) frontMatterFieldHandler {\n\treturn func(d *FrontMatterDescriptor) (bool, error) {\n\t\tdate, slug := dateAndSlugFromBaseFilename(d.Location, d.BaseFilename)\n\t\tif date.IsZero() {\n\t\t\treturn false, nil\n\t\t}","sourceCodeStart":1016,"sourceCodeEnd":1052,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/resources/page/pagemeta/page_frontmatter.go#L1016-L1052","documentation":"Emitted by the front matter date handler in page_frontmatter.go when a field mapped to a date (date, publishDate/publishdate, lastmod, expiryDate, unpublishdate, or any key configured under `frontmatter`) holds a value that `htime.ToTimeInDefaultLocationE` cannot parse in the site's configured location. Hugo needs real `time.Time` values to sort, filter drafts/expired content, and render date formats, so an unparsable value fails the build. The message includes the offending key and the page path or title.","triggerScenarios":"A page with `date: 2024-13-45`, `date: \"last tuesday\"`, an empty-but-non-null quoted value, or a numeric timestamp in an unrecognized form; also fires for custom date fields wired through the `[frontmatter]` config mapping (e.g. `lastmod: [\"myCustomDate\", \"date\"]`) whose source key holds a non-date.","commonSituations":"Locale-formatted dates such as `31/07/2026` or `07-31-2026` that aren't RFC 3339/ISO 8601; TOML dates accidentally quoted as strings with a trailing timezone abbreviation; content migrated from Jekyll/WordPress carrying formats Hugo doesn't accept; setting `timeZone` in config to an invalid IANA name so location-aware parsing misbehaves.","solutions":["Rewrite the value in the reported page as RFC 3339 / ISO 8601, e.g. `2026-07-31` or `2026-07-31T14:00:00-05:00`.","Read the `see <path>` portion of the message to find the exact page, then check every date-ish key on it, not just `date`.","If the field is a custom date wired through `[frontmatter]` in hugo.toml, confirm the source key actually contains a date and reorder the fallback list if it doesn't.","Verify `timeZone` in your site config is a valid IANA zone (e.g. `America/New_York`), since parsing happens in that location.","For bulk migrations, script a pass over content/ normalizing date strings before rebuilding."],"exampleFix":"# before\n---\ndate: 31/07/2026\n---\n\n# after\n---\ndate: 2026-07-31\n---","handlingStrategy":"validation","validationCode":"// validate the date string parses before writing front matter\nif _, err := time.Parse(time.RFC3339, dateStr); err != nil {\n    return fmt.Errorf(\"front matter date %q not RFC3339: %w\", dateStr, err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use ISO 8601 / RFC3339 dates (2026-07-31T10:00:00Z) in front matter","Quote dates consistently in YAML/TOML so they aren't reinterpreted","If using custom date fields via frontmatter config, ensure every content file uses a parsable format","Lint content files in CI with hugo --printPathWarnings or a front matter validator"],"tags":["hugo","front-matter","date-parsing","content","build-error"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}