{"record":{"id":"2b4ee63cbb3d8bef","repo":"gohugoio/hugo","slug":"failed-to-create-config-from-modules-config-w","errorCode":null,"errorMessage":"failed to create config from modules config: %w","messagePattern":"failed to create config from modules config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/allconfig/load.go","lineNumber":86,"sourceCode":"\t\treturn nil, fmt.Errorf(\"failed to load config: %w\", err)\n\t}\n\n\tconfigs, err = fromLoadConfigResult(d.Fs, d.Logger, res)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create config from result: %w\", err)\n\t}\n\n\tmoduleConfig, modulesClient, err := l.loadModules(configs, d.IgnoreModuleDoesNotExist)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to load modules: %w\", err)\n\t}\n\n\tif len(l.ModulesConfigFiles) > 0 {\n\t\t// Config merged in from modules.\n\t\t// Re-read the config.\n\t\tconfigs, err = fromLoadConfigResult(d.Fs, d.Logger, res)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create config from modules config: %w\", err)\n\t\t}\n\t\tif err := configs.transientErr(); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create config from modules config: %w\", err)\n\t\t}\n\t\tconfigs.LoadingInfo.ConfigFiles = append(configs.LoadingInfo.ConfigFiles, l.ModulesConfigFiles...)\n\t} else if err := configs.transientErr(); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create config: %w\", err)\n\t}\n\n\tconfigs.Modules = moduleConfig.AllModules\n\tconfigs.ModulesClient = modulesClient\n\n\tif !d.SkipNpmCheck && npm.NpmPackNeedsUpdate(d.Fs, configs.Modules) {\n\t\td.Logger.Warnln(`npm dependencies are out of sync, please run \"hugo mod npm pack\" (you may also want to run \"npm install\" after that)`)\n\t}\n\n\tif err := configs.Init(d.Fs, d.Logger); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to init config: %w\", err)","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/config/allconfig/load.go#L68-L104","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before: theme ships an invalid outputformats entry\n[[module.imports]]\npath = \"old-theme\"\n\n# after\n[[module.imports]]\npath = \"fixed-theme\"","handlingStrategy":"validation","validationCode":"# Re-run config decode with modules to surface the merged conflict\nhugo config --renderToMemory >/dev/null || echo \"module-config conflict\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin module/theme versions; don't float `latest`.","Override conflicting sections explicitly in project config.","After upgrading a theme, run `hugo config` before deploying."],"tags":["modules","config","decoding","themes"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}