gohugoio/hugo · error
must be all lower case and no spaces
Error message
must be all lower case and no spaces
What it means
`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.
Source
Thrown at common/paths/pathparser.go:1092
func HasExt(p string) bool {
for i := len(p) - 1; i >= 0; i-- {
if p[i] == '.' {
return true
}
if p[i] == '/' {
return false
}
}
return false
}
// ValidateIdentifier returns true if the given string is a valid identifier according
// to Hugo's basic path normalization rules.
func ValidateIdentifier(s string) error {
if s == NormalizePathStringBasic(s) {
return nil
}
return fmt.Errorf("must be all lower case and no spaces")
}
View on GitHub ↗ (pinned to 8a468df065)
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.
Example fix
# before (hugo.toml) [outputFormats."My Format"] # after [outputFormats.myformat]
Defensive patterns
Strategy: validation
Validate before calling
// Validate identifiers (e.g. custom path segments/tokens) before passing to Hugo:
func validSegment(s string) bool {
return s == strings.ToLower(s) && !strings.ContainsAny(s, " \t")
} Prevention
- 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
When it happens
Trigger: 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`.
Common situations: 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.
Related errors
- redirects must have either From or FromRe set
- failed to create config from result: %w
- failed to create config: %w
- failed to decode %q: %w
- language name cannot be empty
AI-assisted analysis of gohugoio/hugo@8a468df065 (2026-07-31).
Data as JSON: /data/errors/a2a649c016fc347d.json.
Report an issue: GitHub ↗.