{"record":{"id":"071a32a3d11e0e41","repo":"gohugoio/hugo","slug":"q-is-an-invalid-dithering-method-see-documentati","errorCode":null,"errorMessage":"%q is an invalid dithering method: see documentation","messagePattern":"%q is an invalid dithering method: see documentation","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"resources/images/filters.go","lineNumber":247,"sourceCode":"\t}\n\n\tvar palette []color.Color\n\tfor _, c := range ditherOptions.Colors {\n\t\tcc, ok, err := toColorGo(c)\n\t\tif !ok || err != nil {\n\t\t\tpanic(fmt.Sprintf(\"%q is an invalid color: specify RGB or RGBA using hexadecimal notation\", c))\n\t\t}\n\t\tpalette = append(palette, cc)\n\t}\n\n\td := dither.NewDitherer(palette)\n\tif method, ok := ditherMethodsErrorDiffusion[strings.ToLower(ditherOptions.Method)]; ok {\n\t\td.Matrix = dither.ErrorDiffusionStrength(method, ditherOptions.Strength)\n\t\td.Serpentine = ditherOptions.Serpentine\n\t} else if method, ok := ditherMethodsOrdered[strings.ToLower(ditherOptions.Method)]; ok {\n\t\td.Mapper = dither.PixelMapperFromMatrix(method, ditherOptions.Strength)\n\t} else {\n\t\tpanic(fmt.Sprintf(\"%q is an invalid dithering method: see documentation\", ditherOptions.Method))\n\t}\n\n\treturn filter{\n\t\tOptions: newFilterOpts(ditherOptions),\n\t\tFilter:  ditherFilter{ditherer: d},\n\t}\n}\n\n// AutoOrient creates a filter that rotates and flips an image as needed per\n// its EXIF orientation tag.\nfunc (*Filters) AutoOrient() gift.Filter {\n\treturn filter{\n\t\tFilter: autoOrientFilter{},\n\t}\n}\n\n// Brightness creates a filter that changes the brightness of an image.\n// The percentage parameter must be in range (-100, 100).","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/resources/images/filters.go#L229-L265","documentation":"Thrown by images.Dither when the Method string matches neither the error-diffusion nor the ordered dithering method maps (filters.go:241-248). Method is lowercased before lookup, so case does not matter, but the spelling must match a known constant.","triggerScenarios":"Passing Method values like \"bayer\", \"none\", \"random\", or misspelled names such as \"floyd-steinberg\" (hyphen) or \"Sierra2_4A\" (the underscore variant is \"sierra2_4a\").","commonSituations":"Developer invents a method name, copies a name from a different library, or includes separators/prefixes the map does not use.","solutions":["Use a documented method name exactly, e.g. floydsteinberg, atkinson, stucki, sierra, clustereddot4x4.","Check dither.go for the authoritative list of accepted keys.","Omit Method to use the default (floydsteinberg)."],"exampleFix":"// before\n{{ $filters = $filters | append (images.Dither (dict \"Method\" \"bayer\")) }}\n// after\n{{ $filters = $filters | append (images.Dither (dict \"Method\" \"floydsteinberg\")) }}","handlingStrategy":"validation","validationCode":"{{ $methods := slice \"floydsteinberg\" \"atkinson\" \"burkes\" \"stucki\" \"sierra\" \"clustereddot4x4\" }}\n{{ if and (ne .method \"\") (not (in $methods (lower .method))) }}\n  {{ errorf \"unknown dither method %q\" .method }}\n{{ end }}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Source method names from the dither.go map keys.","Omit Method to use the default floydsteinberg.","Lowercase the value to match (case-insensitive lookup, but stay consistent)."],"tags":["image-filter","dither","validation","hugo"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}