{"record":{"id":"c05d9e813b42c25a","repo":"gohugoio/hugo","slug":"format-q-not-supported-c05d9e","errorCode":null,"errorMessage":"format %q not supported","messagePattern":"format %q not supported","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tpl/transform/unmarshal.go","lineNumber":79,"sourceCode":"\t}\n\n\tif r, ok := data.(resource.UnmarshableResource); ok {\n\t\tkey := r.Key()\n\n\t\tif key == \"\" {\n\t\t\treturn nil, errors.New(\"no Key set in Resource\")\n\t\t}\n\n\t\tif decoder != metadecoders.Default {\n\t\t\tkey += decoder.OptionsKey()\n\t\t}\n\n\t\tv, err := ns.cacheUnmarshal.GetOrCreate(key, func(string) (*resources.StaleValue[any], error) {\n\t\t\tvar f metadecoders.Format\n\t\t\tif decoder.Format != \"\" {\n\t\t\t\tf = metadecoders.FormatFromString(decoder.Format)\n\t\t\t\tif f == \"\" {\n\t\t\t\t\treturn nil, fmt.Errorf(\"format %q not supported\", decoder.Format)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tf = metadecoders.FormatFromStrings(r.MediaType().Suffixes()...)\n\t\t\t\tif f == \"\" {\n\t\t\t\t\treturn nil, fmt.Errorf(\"MIME %q not supported\", r.MediaType())\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treader, err := r.ReadSeekCloser()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tdefer reader.Close()\n\n\t\t\tb, err := io.ReadAll(reader)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/tpl/transform/unmarshal.go#L61-L97","documentation":"When transform.Unmarshal receives a Resource and an explicit decoder.Format option, it converts the format string to a metadecoders.Format via FormatFromString (unmarshal.go:76-80). Supported formats are org, json, toml, yaml/yml, csv, xml (format.go:26-32, 52-63). If the provided format string doesn't map to any known format, FormatFromString returns empty and Hugo reports 'format %q not supported'.","triggerScenarios":"Calling {{ transform.Unmarshal (dict \"format\" \"ini\") $resource }} or any format string other than json/yaml/yml/toml/csv/xml/org against a Resource argument.","commonSituations":"Requesting INI, properties, or another format Hugo doesn't support; typo in the format name (e.g. 'yam' instead of 'yaml'); assuming a format is supported because it appears in front matter elsewhere.","solutions":["Use one of the supported formats: json, yaml, yml, toml, csv, xml, org.","If you omitted the format option, Hugo infers from the resource MediaType instead (see MIME error).","Pre-convert unsupported formats (e.g. INI) to YAML/JSON with an external tool."],"exampleFix":"// before\n{{ transform.Unmarshal (dict \"format\" \"ini\") $res }}\n\n// after\n{{ transform.Unmarshal (dict \"format\" \"yaml\") $res }}","handlingStrategy":"validation","validationCode":"// Only use supported formats when passing 'format' to transform.Unmarshal:\n//   json, yaml, yml, toml, csv, xml, org\n{{ transform.Unmarshal (dict \"format\" \"json\") $res }}","typeGuard":"// Validate format against the supported set in Go:\nfunc supportedFormat(s string) bool {\n    switch strings.ToLower(s) {\n    case \"json\", \"yaml\", \"yml\", \"toml\", \"csv\", \"xml\", \"org\":\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Restrict the format option to json/yaml/yml/toml/csv/xml/org.","Omit the format option to let Hugo infer from MediaType.","Pre-convert unsupported formats externally."],"tags":["transform","unmarshal","format","resource","validation","template"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}