gohugoio/hugo · error

imaging.webp.hint must be one of picture, photo, drawing, ic

Error message

imaging.webp.hint must be one of picture, photo, drawing, icon, or text, got %q

What it means

WebpConfig.init validates the WebP `hint` option, which tells the libwebp-style encoder what kind of content the image is so it can tune encoding. After lowercasing and falling back to the global `imaging.hint` and then the default ("photo"), the value must be in the hints set: picture, photo, drawing, icon, or text.

Source

Thrown at resources/images/config.go:782

	}
	if c.Quality == 0 {
		c.Quality = ic.Quality
	}
	if c.Hint == "" {
		c.Hint = defaultHint
	}
	if c.Compression == "" {
		c.Compression = defaultCompression
	}
	if c.Quality == 0 {
		c.Quality = 75
	}

	c.Hint = strings.ToLower(c.Hint)
	c.Compression = strings.ToLower(c.Compression)

	if c.Hint != "" && !hints[c.Hint] {
		return fmt.Errorf("imaging.webp.hint must be one of picture, photo, drawing, icon, or text, got %q", c.Hint)
	}
	if c.Method < 0 || c.Method > 6 {
		return fmt.Errorf("imaging.webp.method must be between 0 and 6, got %d", c.Method)
	}
	if c.Compression != "" && !compressionMethods[c.Compression] {
		return fmt.Errorf("imaging.webp.compression must be one of lossy or lossless, got %q", c.Compression)
	}
	if c.Quality < 1 || c.Quality > 100 {
		return fmt.Errorf("imaging.webp.quality must be between 1 and 100 inclusive, got %d", c.Quality)
	}
	return nil
}

View on GitHub ↗ (pinned to 8a468df065)

Solutions

  1. Change the hint to one of: picture, photo, drawing, icon, text.
  2. Remove the key to use the default "photo".
  3. Check the global `imaging.hint` too — the webp block inherits it when its own hint is unset.

Example fix

# before
[imaging.webp]
hint = "graphic"
# after
[imaging.webp]
hint = "drawing"
Defensive patterns

Strategy: validation

Validate before calling

valid := map[string]bool{"picture": true, "photo": true, "drawing": true, "icon": true, "text": true}
if h := cfg.Imaging.WebP.Hint; h != "" && !valid[h] {
    return fmt.Errorf("invalid webp hint %q", h)
}

Prevention

When it happens

Trigger: Setting `[imaging.webp] hint` or the global `[imaging] hint` to any other string in site config. Fires at config load time, before builds.

Common situations: Typos ("pictures", "foto"), guessing values like "default", "graphic", or "screenshot", or copying cwebp's `-preset` names that don't map one-to-one (e.g. "default").

Related errors


AI-assisted analysis of gohugoio/hugo@8a468df065 (2026-07-31). Data as JSON: /data/errors/d394b6881d226625.json. Report an issue: GitHub ↗.