{"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":"validation","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/8a468df065a75c1c7cf9f6850f32148746590ea5/resources/page/pagemeta/page_frontmatter.go#L439-L475","documentation":"During PageConfigLate.Compile, the page's `outputs` list from front matter (or a content adapter) is resolved against the site's configured output formats by name. If any name doesn't match a defined output format, GetByNames fails and Hugo aborts with this error, listing the requested names, because it cannot render the page to an unknown format.","triggerScenarios":"Front matter like `outputs: [\"html\", \"amp\", \"searchindex\"]` where a name (e.g. \"searchindex\") isn't defined under [outputFormats] in site config; content adapters setting outputs with typos or lowercase/spelling variations of custom format names.","commonSituations":"Copying theme docs that assume a custom output format (JSON search index, RSS variants) without adding its [outputFormats.NAME] definition; typos like \"jsonl\" vs \"json\"; removing a custom output format from config while pages still reference it.","solutions":["Define the missing format in site config: [outputFormats.SearchIndex] mediaType = \"application/json\", baseName = \"searchindex\".","Fix the spelling in the page's outputs list to match a built-in or configured format name (names are matched case-insensitively but must exist).","Remove stale format names from front matter after deleting a custom output format from config."],"exampleFix":"# before (front matter)\noutputs: [\"html\", \"searchindex\"]\n# after: add to hugo.toml\n[outputFormats.searchindex]\nmediaType = \"application/json\"\nbaseName = \"searchindex\"","handlingStrategy":"validation","validationCode":"# front matter outputs must name formats defined in config\n---\noutputs: [\"html\", \"json\"]\n---\n# config: ensure [outputFormats.json] exists (json is built-in)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only list output format names that exist (built-in or defined under [outputFormats])","Match case/spelling exactly — `JSON` vs a custom `Calendar` name must match config","Define custom output formats in config before referencing them in page front matter"],"tags":["output-formats","front-matter","configuration","hugo"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}