{"record":{"id":"d394b6881d226625","repo":"gohugoio/hugo","slug":"imaging-webp-hint-must-be-one-of-picture-photo-d","errorCode":null,"errorMessage":"imaging.webp.hint must be one of picture, photo, drawing, icon, or text, got %q","messagePattern":"imaging\\.webp\\.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":782,"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 = 75\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.webp.hint must be one of picture, photo, drawing, icon, or text, got %q\", c.Hint)\n\t}\n\tif c.Method < 0 || c.Method > 6 {\n\t\treturn fmt.Errorf(\"imaging.webp.method must be between 0 and 6, got %d\", c.Method)\n\t}\n\tif c.Compression != \"\" && !compressionMethods[c.Compression] {\n\t\treturn fmt.Errorf(\"imaging.webp.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.webp.quality must be between 1 and 100 inclusive, got %d\", c.Quality)\n\t}\n\treturn nil\n}\n","sourceCodeStart":764,"sourceCodeEnd":795,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/resources/images/config.go#L764-L795","documentation":"Validates the WebP hint value after lowercasing and fallback resolution. The hint (called 'preset' in libwebp) controls encoding behavior and must be one of: picture, photo, drawing, icon, or text. If unset, it falls back to the global hint, then to the default 'photo'. Only checked when non-empty after resolution.","triggerScenarios":"Setting imaging.webp.hint (or the global imaging.hint) to a string not in the allowed set. Case-insensitive after lowercasing.","commonSituations":"Typing 'photograph' instead of 'photo'; 'screenshot' instead of 'picture' or 'drawing'; using a hint from a different image library.","solutions":["Set imaging.webp.hint to one of: picture, photo, drawing, icon, or text.","Omit the hint to use the default 'photo'.","Check the global imaging.hint if the WebP-specific hint is unset, since WebP inherits it."],"exampleFix":"# before (hugo.toml)\n[imaging.webp]\nhint = \"photograph\"\n\n# after\n[imaging.webp]\nhint = \"photo\"","handlingStrategy":"validation","validationCode":"// Validate WebP hint\nfunc validateWebpHint(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 webp 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'.","Use 'picture' for images that are a composite of photo and synthetic elements.","The hint and compression settings are independent — set both correctly."],"tags":["hugo","imaging","webp","config-validation"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}