gohugoio/hugo · error
failed to create config from modules config
Error message
failed to create config from modules config: %w
What it means
When modules contribute config files (l.ModulesConfigFiles non-empty), Hugo re-reads the merged config via a second fromLoadConfigResult call. If that re-decode fails, the error is wrapped here. The cause is a config value injected by a module/theme that is invalid when combined with project config.
Solutions
- Inspect the wrapped decode error for the section key and module config file (named in LoadingInfo.ConfigFiles).
- Update or pin the offending theme/module to a compatible version.
- Override the conflicting section in project config with explicit values.
- Run `hugo config` after temporarily disabling module imports to compare.
Example fix
# before: theme ships an invalid outputformats entry [[module.imports]] path = "old-theme" # after [[module.imports]] path = "fixed-theme"
Defensive patterns
Strategy: validation
Validate before calling
# Re-run config decode with modules to surface the merged conflict hugo config --renderToMemory >/dev/null || echo "module-config conflict"
Prevention
- Pin module/theme versions; don't float `latest`.
- Override conflicting sections explicitly in project config.
- After upgrading a theme, run `hugo config` before deploying.
When it happens
Trigger: A theme/module defines `[languages]`, `[markup]`, `[outputformats]`, etc. that conflict with or are malformed relative to the project config after merge; a module adds a section whose type mismatches after merge.
Common situations: Upgrading a theme that changed a config section shape; two modules merging the same key with incompatible types; a theme assuming a Hugo feature your version/config doesn't support.
Related errors
- failed to load modules
- cannot vendor module
- could not determine content directory for
- failed to apply mounts for project
- failed to create config from result
AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09).
Data as JSON: /api/errors/2b4ee63cbb3d8bef.
Report an issue: GitHub.
Appendix: source
Thrown at config/allconfig/load.go:86
return nil, fmt.Errorf("failed to load config: %w", err)
}
configs, err = fromLoadConfigResult(d.Fs, d.Logger, res)
if err != nil {
return nil, fmt.Errorf("failed to create config from result: %w", err)
}
moduleConfig, modulesClient, err := l.loadModules(configs, d.IgnoreModuleDoesNotExist)
if err != nil {
return nil, fmt.Errorf("failed to load modules: %w", err)
}
if len(l.ModulesConfigFiles) > 0 {
// Config merged in from modules.
// Re-read the config.
configs, err = fromLoadConfigResult(d.Fs, d.Logger, res)
if err != nil {
return nil, fmt.Errorf("failed to create config from modules config: %w", err)
}
if err := configs.transientErr(); err != nil {
return nil, fmt.Errorf("failed to create config from modules config: %w", err)
}
configs.LoadingInfo.ConfigFiles = append(configs.LoadingInfo.ConfigFiles, l.ModulesConfigFiles...)
} else if err := configs.transientErr(); err != nil {
return nil, fmt.Errorf("failed to create config: %w", err)
}
configs.Modules = moduleConfig.AllModules
configs.ModulesClient = modulesClient
if !d.SkipNpmCheck && npm.NpmPackNeedsUpdate(d.Fs, configs.Modules) {
d.Logger.Warnln(`npm dependencies are out of sync, please run "hugo mod npm pack" (you may also want to run "npm install" after that)`)
}
if err := configs.Init(d.Fs, d.Logger); err != nil {
return nil, fmt.Errorf("failed to init config: %w", err)View on GitHub (pinned to 52c9bd7908)