{"id":"a2a649c016fc347d","repo":"gohugoio/hugo","slug":"must-be-all-lower-case-and-no-spaces","errorCode":null,"errorMessage":"must be all lower case and no spaces","messagePattern":"must be all lower case and no spaces","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/paths/pathparser.go","lineNumber":1092,"sourceCode":"func HasExt(p string) bool {\n\tfor i := len(p) - 1; i >= 0; i-- {\n\t\tif p[i] == '.' {\n\t\t\treturn true\n\t\t}\n\t\tif p[i] == '/' {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn false\n}\n\n// ValidateIdentifier returns true if the given string is a valid identifier according\n// to Hugo's basic path normalization rules.\nfunc ValidateIdentifier(s string) error {\n\tif s == NormalizePathStringBasic(s) {\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"must be all lower case and no spaces\")\n}\n","sourceCodeStart":1074,"sourceCodeEnd":1094,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/common/paths/pathparser.go#L1074-L1094","documentation":"`paths.ValidateIdentifier` enforces Hugo's basic path-normalization rule: an identifier must already equal its normalized form (lowercase, no spaces). It's used to validate user-supplied keys such as output-format, media-type, or segment/config identifiers so that internal path-based lookups, which normalize aggressively, can't silently mismatch the configured name.","triggerScenarios":"Providing an identifier in site configuration that contains uppercase letters or spaces where Hugo calls `ValidateIdentifier` — e.g. defining custom output format or media type names, cache/segment keys, or similar config identifiers like `name = \"My Format\"` instead of `myformat`.","commonSituations":"Copying human-readable titles into config `name` fields; migrating configs where older Hugo versions were lenient; camelCase identifiers like `ampPages` used where a lowercase key is required.","solutions":["Rename the identifier in your config to all lowercase with no spaces (use hyphens if separation is needed), matching `NormalizePathStringBasic` output.","Update every reference to the old identifier (front matter `outputs`, templates) to the new lowercase name."],"exampleFix":"# before (hugo.toml)\n[outputFormats.\"My Format\"]\n# after\n[outputFormats.myformat]","handlingStrategy":"validation","validationCode":"// Validate identifiers (e.g. custom path segments/tokens) before passing to Hugo:\nfunc validSegment(s string) bool {\n    return s == strings.ToLower(s) && !strings.ContainsAny(s, \" \\t\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep configured identifiers (permalink tokens, path segments, language keys) all lowercase with no spaces","Slugify user-supplied names (lowercase, hyphens) before using them in config or front matter","Add a config lint step in CI that runs hugo config to catch invalid values early"],"tags":["hugo","config","validation","naming"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}