gohugoio/hugo · error
invalid deployment.orderings.pattern: %v
Error message
invalid deployment.orderings.pattern: %v
What it means
Raised at deployConfig.go:173 when compiling an entry of `deployment.order` (config key `order`, error text says orderings) fails. Each ordering string is compiled with `regexp.Compile` and appended to `dcfg.Ordering`, which later groups uploads into sequential batches during deploy; an invalid regex aborts config decoding.
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 8a468df065)
Solutions
- Correct the invalid entry in `deployment.order` so each string is a valid RE2 regex, e.g. `order = ['.*\.jpg$', '.*\.gif$']`.
- Use single-quoted TOML strings to keep backslashes literal.
- If you meant simple suffix matching, a regex like `\.jpg$` suffices — avoid unnecessary metacharacters.
Example fix
# before [deployment] order = ["*.jpg", "*.gif"] # after [deployment] order = ['.*\.jpg$', '.*\.gif$']
Defensive patterns
Strategy: validation
Validate before calling
for i, o := range cfg.Deployment.Order {
if _, err := regexp.Compile(o); err != nil {
return fmt.Errorf("deployment.order[%d] %q: %w", i, o, err)
}
} Prevention
- deployment.order entries are RE2 regexps; compile-check each one before committing config
- Keep ordering patterns simple (prefix/suffix anchors) to reduce syntax-error risk
- Cover config parsing with a smoke test that loads hugo.toml and validates the deployment section
When it happens
Trigger: `hugo deploy` with a `deployment.order = ["..."]` list containing a string that is not valid Go RE2 regex — same failure class as matchers: bad escapes, unbalanced groups, PCRE-only syntax.
Common situations: Using glob patterns instead of regexes in `order`; escaping issues in TOML/YAML; copying `.*` patterns with stray metacharacters like an unmatched `)`.
Related errors
- invalid deployment.matchers.pattern: %v
- empty deployment matcher
- deploy not supported in this version of Hugo; install a rele
- filename not match
- failed to compile ignoreFiles pattern %q: %s
AI-assisted analysis of gohugoio/hugo@8a468df065 (2026-07-31).
Data as JSON: /data/errors/83961d6618ab7eaf.json.
Report an issue: GitHub ↗.