{"record":{"id":"f4001f932f281910","repo":"gohugoio/hugo","slug":"imaging-avif-hint-must-be-one-of-picture-photo-d","errorCode":null,"errorMessage":"imaging.avif.hint must be one of picture, photo, drawing, icon, or text, got %q","messagePattern":"imaging\\.avif\\.hint must be one of picture, photo, drawing, icon, or text, got %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"resources/images/config.go","lineNumber":718,"sourceCode":"\t}\n\tif c.Quality == 0 {\n\t\tc.Quality = ic.Quality\n\t}\n\tif c.Hint == \"\" {\n\t\tc.Hint = defaultHint\n\t}\n\tif c.Compression == \"\" {\n\t\tc.Compression = defaultCompression\n\t}\n\tif c.Quality == 0 {\n\t\tc.Quality = 60\n\t}\n\n\tc.Hint = strings.ToLower(c.Hint)\n\tc.Compression = strings.ToLower(c.Compression)\n\n\tif c.Hint != \"\" && !hints[c.Hint] {\n\t\treturn fmt.Errorf(\"imaging.avif.hint must be one of picture, photo, drawing, icon, or text, got %q\", c.Hint)\n\t}\n\tif c.EncoderSpeed < 1 || c.EncoderSpeed > 10 {\n\t\treturn fmt.Errorf(\"imaging.avif.encoderSpeed must be between 1 and 10, got %d\", c.EncoderSpeed)\n\t}\n\n\tif c.Compression != \"\" && !compressionMethods[c.Compression] {\n\t\treturn fmt.Errorf(\"imaging.avif.compression must be one of lossy or lossless, got %q\", c.Compression)\n\t}\n\tif c.Quality < 1 || c.Quality > 100 {\n\t\treturn fmt.Errorf(\"imaging.avif.quality must be between 1 and 100 inclusive, got %d\", c.Quality)\n\t}\n\n\treturn nil\n}\n\n// WebpConfig holds WebP-specific encoding configuration.\ntype WebpConfig struct {\n\t// Quality setting (1-100). Falls back to the global imaging.quality if unset.","sourceCodeStart":700,"sourceCodeEnd":736,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/resources/images/config.go#L700-L736","documentation":"Validates the AVIF hint value after lowercasing and fallback resolution. The hint controls chroma subsampling and must be one of: picture, photo, drawing, icon, or text (defined in the hints map). If unset, it falls back to the global hint, then to the default 'photo'. Only checked when the hint is non-empty after resolution.","triggerScenarios":"Setting imaging.avif.hint (or the global imaging.hint) to a string that is not picture, photo, drawing, icon, or text. Case does not matter — the value is lowercased before validation.","commonSituations":"Typing 'photograph' instead of 'photo'; 'graphics' instead of 'drawing'; using a hint name from a different encoder's vocabulary.","solutions":["Set imaging.avif.hint to one of: picture, photo, drawing, icon, or text.","Omit the hint key to use the default 'photo', which is correct for most photographs.","If you set a global imaging.hint, ensure it is also valid since AVIF inherits it when the AVIF-specific hint is unset."],"exampleFix":"# before (hugo.toml)\n[imaging.avif]\nhint = \"photograph\"\n\n# after\n[imaging.avif]\nhint = \"photo\"","handlingStrategy":"validation","validationCode":"// Validate AVIF hint\nfunc validateAvifHint(hint string) error {\n    valid := map[string]bool{\"picture\":true,\"photo\":true,\"drawing\":true,\"icon\":true,\"text\":true}\n    h := strings.ToLower(hint)\n    if h != \"\" && !valid[h] {\n        return fmt.Errorf(\"invalid avif hint %q; valid: picture, photo, drawing, icon, text\", h)\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Omit the hint to use the default 'photo', which covers most use cases.","Use 'drawing' for line art, 'icon' for small UI graphics, 'text' for images dominated by text.","Remember the hint is shared vocabulary between WebP and AVIF — the same five values apply to both."],"tags":["hugo","imaging","avif","config-validation"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}