gohugoio/hugo · error
%q is not a valid resample filter
Error message
%q is not a valid resample filter
What it means
The `resampleFilter` in the `[imaging]` config selects the resampling kernel (box, lanczos, catmullrom, mitchellnetravali, linear, nearestneighbor, gaussian, etc.) via the imageFilters map; an unknown name fails config decode. Note a quirk in the source: the error prints the zero-value `filter` variable rather than the configured string, so the message may show `""` or an unhelpful value instead of what you typed (resources/images/config.go:229).
Source
Thrown at resources/images/config.go:229
return i, nil, err
}
i.BgColor, err = hexStringToColorGo(i.Imaging.BgColor)
if err != nil {
return i, nil, err
}
if i.Imaging.Anchor != "" {
anchor, found := anchorPositions[i.Imaging.Anchor]
if !found {
return i, nil, fmt.Errorf("invalid anchor value %q in imaging config", i.Imaging.Anchor)
}
i.Anchor = anchor
}
filter, found := imageFilters[i.Imaging.ResampleFilter]
if !found {
return i, nil, fmt.Errorf("%q is not a valid resample filter", filter)
}
i.ResampleFilter = filter
return i, i.Imaging, nil
}
ns, err := config.DecodeNamespace[ImagingConfig](in, buildConfig)
if err != nil {
return nil, err
}
return ns, nil
}
func DecodeImageConfig(options []string, defaults *config.ConfigNamespace[ImagingConfig, ImagingConfigInternal], sourceFormat Format) (ImageConfig, error) {
var (
c ImageConfig = newImageConfig()
err errorView on GitHub ↗ (pinned to 8a468df065)
Solutions
- Use a supported filter name such as `box`, `lanczos`, `catmullrom`, `mitchellnetravali`, `linear`, `nearestneighbor`, or `gaussian`.
- Delete the resampleFilter key to fall back to the default (box).
- If the message shows an empty/odd value, check your actual config string — the error text prints the wrong variable, so trust your config file, not the quoted value.
Example fix
# before [imaging] resampleFilter = "bicubic" # after [imaging] resampleFilter = "catmullrom"
Defensive patterns
Strategy: validation
Validate before calling
valid := map[string]bool{"box": true, "lanczos": true, "catmullrom": true, "mitchellnetravali": true, "linear": true, "nearestneighbor": true, "gaussian": true, "hermite": true, "bspline": true, "hann": true, "hamming": true, "blackman": true, "bartlett": true, "welch": true, "cosine": true}
if !valid[strings.ToLower(filter)] { /* fix imaging.resampleFilter */ } Prevention
- Use a documented resample filter name (Box, Lanczos, CatmullRom, MitchellNetravali, Linear, NearestNeighbor, Gaussian, ...) in imaging.resampleFilter or resize specs like `"600x400 Lanczos"`
- Names are case-insensitive but must match exactly otherwise — no abbreviations
- Verify per-image filter arguments in templates against the same list
When it happens
Trigger: `[imaging]\nresampleFilter = "bicubic"` or any name absent from imageFilters; also an explicitly empty string, since only the absent key gets the default (box).
Common situations: Using filter names from other tools (ImageMagick's `bicubic`, `triangle` spellings); typos like `lanczos3`; setting the key to an empty string via templated config.
Related errors
- invalid anchor value %q in imaging config
- config needs a filename
- invalid color code: %q
- imaging.avif.compression must be one of lossy or lossless, g
- imaging.avif.quality must be between 1 and 100 inclusive, go
AI-assisted analysis of gohugoio/hugo@8a468df065 (2026-07-31).
Data as JSON: /data/errors/d549dbedb147e497.json.
Report an issue: GitHub ↗.