{"record":{"id":"ce9ab86be5465cf8","repo":"gohugoio/hugo","slug":"outputformat-with-key-q-not-found","errorCode":null,"errorMessage":"OutputFormat with key %q not found","messagePattern":"OutputFormat with key %q not found","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"output/outputFormat.go","lineNumber":305,"sourceCode":"func (formats Formats) GetByName(name string) (f Format, found bool) {\n\tfor _, ff := range formats {\n\t\tif strings.EqualFold(name, ff.Name) {\n\t\t\tf = ff\n\t\t\tfound = true\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}\n\n// GetByNames gets a list of formats given a list of identifiers.\nfunc (formats Formats) GetByNames(names ...string) (Formats, error) {\n\tvar types []Format\n\n\tfor _, name := range names {\n\t\ttpe, ok := formats.GetByName(name)\n\t\tif !ok {\n\t\t\treturn types, fmt.Errorf(\"OutputFormat with key %q not found\", name)\n\t\t}\n\t\ttypes = append(types, tpe)\n\t}\n\treturn types, nil\n}\n\n// BaseFilename returns the base filename of f including an extension (ie.\n// \"index.xml\").\nfunc (f Format) BaseFilename() string {\n\treturn f.BaseName + f.MediaType.FirstSuffix.FullSuffix\n}\n\n// IsZero returns true if f represents a zero value.\nfunc (f Format) IsZero() bool {\n\treturn f.Name == \"\"\n}\n\n// MarshalJSON returns the JSON encoding of f.","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/output/outputFormat.go#L287-L323","documentation":"Thrown by Formats.GetByNames (output/outputFormat.go:305) when one of the requested output format names is not present in the slice of configured Formats. Hugo iterates the names and, for any name with no case-insensitive match in the Formats slice, returns this error naming the missing key. This is the error behind an unknown output format referenced in a page's 'outputs' front matter or the site [outputs] config.","triggerScenarios":"A page or section lists outputs = [\"html\", \"AMP\"] but AMP is not enabled; site config [outputs] home = [\"html\", \"json\"] where the JSON format was never defined or was removed by a theme change; referencing a custom format name that has a typo or differing case that doesn't match the registered Name.","commonSituations":"Enabling outputs for a format you forgot to define in [outputFormats]; renaming an output format without updating references; a theme swap that removes a previously available format; case mismatch (e.g. 'amp' vs 'AMP' — note EqualFold is used so case is fine, but the format must exist).","solutions":["Check the exact name in the error and ensure an [outputFormats.NAME] with that Name exists (or use a built-in like HTML, AMP, RSS, JSON, CSV).","If it is a custom format, add the full [outputFormats.NAME] definition.","Update the [outputs] config or page front matter to remove the unknown format if it is no longer wanted.","Run hugo config to print the list of resolved output formats and confirm the name matches."],"exampleFix":"# before (json output requested but not defined)\n[outputs]\nhome = [\"html\", \"json\"]\n\n# after (define the format or remove the reference)\n[outputFormats.json]\nmediaType = \"application/json\"\nbaseName = \"index\"\n[outputs]\nhome = [\"html\", \"json\"]","handlingStrategy":"validation","validationCode":"// Verify each requested output name exists before GetByNames.\nfunc allFormatsExist(formats output.Formats, names []string) error {\n    for _, n := range names {\n        if _, ok := formats.GetByName(n); !ok {\n            return fmt.Errorf(\"output format %q not defined\", n)\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"got, err := formats.GetByNames(want...)\nif err != nil {\n    return fmt.Errorf(\"referenced output format missing: %w\", err)\n}","preventionTips":["Define a custom [outputFormats.NAME] before referencing it in [outputs] or page front matter.","Remove stale output references after format renames/theme swaps.","List formats with `hugo config`."],"tags":["output-formats","config","hugo"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}