{"record":{"id":"d549dbedb147e497","repo":"gohugoio/hugo","slug":"q-is-not-a-valid-resample-filter","errorCode":null,"errorMessage":"%q is not a valid resample filter","messagePattern":"%q is not a valid resample filter","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"resources/images/config.go","lineNumber":229,"sourceCode":"\t\t\treturn i, nil, err\n\t\t}\n\n\t\ti.BgColor, err = hexStringToColorGo(i.Imaging.BgColor)\n\t\tif err != nil {\n\t\t\treturn i, nil, err\n\t\t}\n\n\t\tif i.Imaging.Anchor != \"\" {\n\t\t\tanchor, found := anchorPositions[i.Imaging.Anchor]\n\t\t\tif !found {\n\t\t\t\treturn i, nil, fmt.Errorf(\"invalid anchor value %q in imaging config\", i.Imaging.Anchor)\n\t\t\t}\n\t\t\ti.Anchor = anchor\n\t\t}\n\n\t\tfilter, found := imageFilters[i.Imaging.ResampleFilter]\n\t\tif !found {\n\t\t\treturn i, nil, fmt.Errorf(\"%q is not a valid resample filter\", filter)\n\t\t}\n\n\t\ti.ResampleFilter = filter\n\n\t\treturn i, i.Imaging, nil\n\t}\n\n\tns, err := config.DecodeNamespace[ImagingConfig](in, buildConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ns, nil\n}\n\nfunc DecodeImageConfig(options []string, defaults *config.ConfigNamespace[ImagingConfig, ImagingConfigInternal], sourceFormat Format) (ImageConfig, error) {\n\tvar (\n\t\tc   ImageConfig = newImageConfig()\n\t\terr error","sourceCodeStart":211,"sourceCodeEnd":247,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/resources/images/config.go#L211-L247","documentation":"Returned by the DecodeConfig buildConfig closure when imaging.resampleFilter is not a key in the imageFilters map. Note the message prints the zero-value filter variable (the failed map lookup result) rather than the input string, so the message text may show the resampling zero value -- a known diagnostic quirk. Valid filters include box, lanczos, linear, nearestneighbor, catmullrom, etc.","triggerScenarios":"Setting [imaging] resampleFilter = \"bicubic\" or any name not in the recognised set. The lookup imageFilters[input] returns found=false and this error fires.","commonSituations":"Expecting a filter name like 'bicubic' or 'cubic' that is not provided (Hugo uses CatmullRom as the bicubic-equivalent); a typo; a filter name from a different library.","solutions":["Use a valid resample filter: Box, NearestNeighbor, Linear, Hermite, MitchellNetravali, CatmullRom, BSpline, Gaussian, Lanczos, Hann, Hamming, Blackman, Bartlett, Welch, or Cosine.","Pick CatmullRom if you wanted bicubic-quality downscaling.","Leave it unset to keep the default Box."],"exampleFix":"// before\n[imaging]\nresampleFilter = \"bicubic\"\n\n// after\n[imaging]\nresampleFilter = \"CatmullRom\"","handlingStrategy":"validation","validationCode":"var validFilters = map[string]bool{\"box\": true, \"nearestneighbor\": true, \"linear\": true, \"hermite\": true, \"mitchellnetravali\": true, \"catmullrom\": true, \"bspline\": true, \"gaussian\": true, \"lanczos\": true, \"hann\": true, \"hamming\": true, \"blackman\": true, \"bartlett\": true, \"welch\": true, \"cosine\": true}\nfunc isValidFilter(s string) bool { return validFilters[strings.ToLower(s)] }","typeGuard":"func isValidResampleFilter(s string) bool {\n    valid := map[string]bool{\"box\": true, \"nearestneighbor\": true, \"linear\": true, \"hermite\": true, \"mitchellnetravali\": true, \"catmullrom\": true, \"bspline\": true, \"gaussian\": true, \"lanczos\": true, \"hann\": true, \"hamming\": true, \"blackman\": true, \"bartlett\": true, \"welch\": true, \"cosine\": true}\n    return valid[strings.ToLower(s)]\n}","tryCatchPattern":null,"preventionTips":["Use CatmullRom for bicubic-equivalent results.","Leave unset to keep the Box default.","Note the message prints a zero value, not your input -- check your config string."],"tags":["image-processing","config","resample-filter","validation"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}