{"record":{"id":"37d2fa4dedf66576","repo":"gohugoio/hugo","slug":"failed-to-create-config-from-result-w","errorCode":null,"errorMessage":"failed to create config from result: %w","messagePattern":"failed to create config from result: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/allconfig/load.go","lineNumber":73,"sourceCode":"\t}\n\n\tif d.Logger == nil {\n\t\td.Logger = loggers.NewDefault()\n\t}\n\n\tl := &configLoader{ConfigSourceDescriptor: d, cfg: config.New()}\n\t// Make sure we always do this, even in error situations,\n\t// as we have commands (e.g. \"hugo mod init\") that will\n\t// use a partial configuration to do its job.\n\tdefer l.deleteMergeStrategies()\n\tres, _, err := l.loadConfigMain(d)\n\tif err != nil {\n\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...)","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/config/allconfig/load.go#L55-L91","documentation":"Wraps the first call to fromLoadConfigResult, which decodes the freshly-parsed config map into the structured Config and per-language Config map, runs all section decoders, compiles server/cache-buster config, and builds file caches. So this is the umbrella for any decode-stage failure that is NOT a file parse error (those surface as 266). Errors 260, 261, 262 are produced inside this function and bubble up wrapped here.","triggerScenarios":"Any decoder failure (languages, related, markup, build, etc.) during the first decode pass; a cache-buster or server glob/regexp compile failure in CompileConfig; file cache creation failure.","commonSituations":"A structurally valid config file (parses fine) but with semantically invalid section values; enabling `[server]` headers/redirects with bad globs; a `[build.cacheBusters]` entry with a bad regexp.","solutions":["Inspect the wrapped error chain: it typically contains a more specific 'failed to decode \"<key>\"' or compile error.","Fix the named section per the inner error guidance (see errors 260-264, 273-279).","Run `hugo config` only after the inner error is resolved."],"exampleFix":"// no direct code fix; resolve the wrapped decoder error first\n// e.g. if wrapped is 'failed to decode \"related\"', fix the [related] section.","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"cfgs, err := allconfig.LoadConfig(d)\nif err != nil {\n    // Walk errors.Is/As to find the specific decoder error.\n    var de *herrors.FileError\n    if errors.As(err, &de) { /* position info available */ }\n    return err\n}","preventionTips":["Resolve file syntax (266) first; this error is purely decode-stage.","Use `hugo config` iteratively as you fix sections."],"tags":["config","decoding","loading"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}