{"record":{"id":"0ec8673973faced3","repo":"gohugoio/hugo","slug":"failed-to-resolve-output-formats-v-w","errorCode":null,"errorMessage":"failed to resolve output formats %v: %w","messagePattern":"failed to resolve output formats (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"resources/page/pagemeta/page_frontmatter.go","lineNumber":457,"sourceCode":"// Compile sets up the page configuration after all fields have been set.\nfunc (p *PageConfigLate) Compile(e *PageConfigEarly, logger loggers.Logger, outputFormats output.Formats) error {\n\tif e.IsFromContentAdapter {\n\t\tif err := mapstructure.WeakDecode(p.ContentAdapterData, p); err != nil {\n\t\t\terr = fmt.Errorf(\"failed to decode page map: %w\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif p.Params == nil {\n\t\tp.Params = make(hmaps.Params)\n\t} else {\n\t\thmaps.PrepareParams(p.Params)\n\t}\n\n\tif len(p.Outputs) > 0 {\n\t\toutFormats, err := outputFormats.GetByNames(p.Outputs...)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to resolve output formats %v: %w\", p.Outputs, err)\n\t\t} else {\n\t\t\tp.ConfiguredOutputFormats = outFormats\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// MarkupToMediaType converts a markup string to a media type.\nfunc MarkupToMediaType(s string, mediaTypes media.Types) media.Type {\n\ts = strings.ToLower(s)\n\tmt, _ := mediaTypes.GetBestMatch(markup.ResolveMarkup(s))\n\treturn mt\n}\n\ntype ResourceConfig struct {\n\tPath    string\n\tName    string","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/resources/page/pagemeta/page_frontmatter.go#L439-L475","documentation":"Thrown by PageConfigLate.Compile when the 'outputs' front matter list is non-empty but outputFormats.GetByNames cannot resolve one or more of the named output formats. The wrapped error is from the outputFormats lookup; the printed list is the value of p.Outputs.","triggerScenarios":"Front matter sets 'outputs: [foo]' (or a content adapter sets Outputs) where 'foo' is not one of the configured output format names (e.g. html, amp, rss, json, csv).","commonSituations":"Typo in an output format name, referencing a custom output format that was never defined under [outputFormats], or assuming a format exists in a theme without inheriting its config.","solutions":["Use only output format names that are defined in your [outputFormats] config or built-in (html, amp, rss, json, etc.).","Define the missing custom output format under [outputFormats] and add it to the kind's outputs list.","Remove the 'outputs' front matter key to use the site default outputs for that page kind."],"exampleFix":"# before\n---\noutputs: [htm]\n---\n# after\n---\noutputs: [html]\n---","handlingStrategy":"validation","validationCode":"valid := map[string]bool{}\nfor _, f := range configuredOutputFormats { valid[f.Name] = true }\nfor _, name := range pcfg.Outputs {\n    if !valid[name] { return fmt.Errorf(\"unknown output format %q\", name) }\n}","typeGuard":null,"tryCatchPattern":"if err := pcfg.Compile(early, logger, formats); err != nil {\n    return fmt.Errorf(\"outputs for %s: %w\", path, err)\n}","preventionTips":["Only use output format names defined under [outputFormats] or built-in.","Define custom output formats before referencing them in 'outputs'.","Omit 'outputs' to use the site default for the page kind."],"tags":["hugo","output-format","front-matter","configuration"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}