gohugoio/hugo · error
invalid deployment.orderings.pattern
Error message
invalid deployment.orderings.pattern: %v
What it means
DecodeConfig (deploy/deployconfig/deployConfig.go:171) compiles each entry in deployment.order as a regexp and appends it to the Ordering list (which controls upload ordering). This wraps regexp.Compile failure for any order pattern.
Solutions
- Treat each order entry as a regex: use '.*' for 'any', anchor as needed, escape literal dots.
- Validate every entry with regexp.Compile in isolation.
- Balance parentheses/character classes; remove stray quantifiers.
Example fix
# before [deployment] order = ["index.html", "*.css"] # second entry is glob -> invalid regex # after [deployment] order = ["index\\.html$", ".*\\.css$"]
Defensive patterns
Strategy: validation
Validate before calling
import "regexp"
func ValidateOrderPatterns(order []string) error {
for _, o := range order {
if _, err := regexp.Compile(o); err != nil {
return fmt.Errorf("order %q: %w", o, err)
}
}
return nil
} Try / catch
if _, err := deployconfig.DecodeConfig(cfg); err != nil {
return err
} Prevention
- order entries are regex, not globs.
- Anchor and escape patterns deliberately.
- Lint order patterns in CI.
When it happens
Trigger: A value under `order = [...]` (deployment orderings) that is not valid regex: e.g. 'index.html' written as a glob, an unbalanced group, or a dangling '*'.
Common situations: Assuming order entries are globs or plain substrings; copy-pasting a pattern from a glob-based tool; typo producing invalid regex.
Related errors
- invalid deployment.matchers.pattern
- deployment target not found
- empty deployment matcher
- empty deployment target
- failed to compile cache buster target
AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09).
Data as JSON: /api/errors/83961d6618ab7eaf.
Report an issue: GitHub.
Appendix: source
Thrown at deploy/deployconfig/deployConfig.go:173
}
if err := tgt.ParseIncludeExclude(); err != nil {
return dcfg, err
}
}
var err error
for _, m := range dcfg.Matchers {
if *m == (Matcher{}) {
return dcfg, errors.New("empty deployment matcher")
}
m.Re, err = regexp.Compile(m.Pattern)
if err != nil {
return dcfg, fmt.Errorf("invalid deployment.matchers.pattern: %v", err)
}
}
for _, o := range dcfg.Order {
re, err := regexp.Compile(o)
if err != nil {
return dcfg, fmt.Errorf("invalid deployment.orderings.pattern: %v", err)
}
dcfg.Ordering = append(dcfg.Ordering, re)
}
return dcfg, nil
}
View on GitHub (pinned to 52c9bd7908)