gohugoio/hugo · error
invalid metadata source %q in imaging.meta.sources config; m
Error message
invalid metadata source %q in imaging.meta.sources config; must be one of %s
What it means
imaging.meta.sources controls which metadata blocks (EXIF, IPTC, XMP) Hugo decodes from images. Each entry is lowercased and checked against validMetaSources; an unknown source name is a config error since Hugo has no decoder for it.
Source
Thrown at resources/images/config.go:607
if len(cfg.Meta.Fields) == 0 {
// Default: include all fields except technical metadata.
// Don't change this for no good reason. Please don't.
cfg.Meta.Fields = []string{
"! *{GPS,Exif,Exposure[MPB],Contrast,Resolution,Sharp,JPEG,Metering,Sensing,Saturation,ColorSpace,Flash,WhiteBalance}*",
}
}
if len(cfg.Meta.Sources) == 0 {
// Default to EXIF and IPTC (XMP is slower to decode).
cfg.Meta.Sources = []string{"exif", "iptc"}
} else {
// Normalize to lowercase.
for i, s := range cfg.Meta.Sources {
cfg.Meta.Sources[i] = strings.ToLower(s)
if !validMetaSources[cfg.Meta.Sources[i]] {
keys := slices.Collect(maps.Keys(validMetaSources))
slices.Sort(keys)
return fmt.Errorf("invalid metadata source %q in imaging.meta.sources config; must be one of %s", s, keys)
}
}
}
return nil
}
type ExifConfig struct {
// Regexp matching the Exif fields you want from the (massive) set of Exif info
// available. As we cache this info to disk, this is for performance and
// disk space reasons more than anything.
// If you want it all, put ".*" in this config setting.
// Note that if neither this or ExcludeFields is set, Hugo will return a small
// default set.
IncludeFields string
// Regexp matching the Exif fields you want to exclude. This may be easier to use
// than IncludeFields above, depending on what you want.View on GitHub ↗ (pinned to 8a468df065)
Solutions
- Correct the entry to one of the valid sources listed in the error message (e.g. exif, iptc, xmp).
- Remove imaging.meta.sources entirely to get the default of exif + iptc.
- Check the Hugo docs for imaging.meta.sources valid values for your Hugo version.
Example fix
# before (hugo.toml) [imaging.meta] sources = ["exif", "ipct"] # after [imaging.meta] sources = ["exif", "iptc"]
Defensive patterns
Strategy: validation
Validate before calling
valid := map[string]bool{"exif": true, "xmp": true, "iptc": true}
for _, s := range cfg.Imaging.Meta.Sources {
if !valid[strings.ToLower(s)] {
return fmt.Errorf("invalid imaging.meta.sources entry %q", s)
}
} Prevention
- Check imaging.meta.sources entries against the documented allowed set for your Hugo version before building
- Use lowercase source names exactly as documented; avoid typos like "EXIF " with whitespace
- Pin the Hugo version so the allowed set doesn't shift under you
When it happens
Trigger: Setting imaging.meta.sources = ["exif", "xmp2"] or any entry not in the valid set (the error message lists the sorted valid keys) in site config; fires during config init.
Common situations: Typos like 'ipct' for 'iptc'; guessing source names ('metadata', 'jpeg'); using a value from a different tool's config; leftover entries after a Hugo version changed the supported set.
Related errors
- redirects must have either From or FromRe set
- failed to create config from result: %w
- failed to create config: %w
- failed to decode %q: %w
- language name cannot be empty
AI-assisted analysis of gohugoio/hugo@8a468df065 (2026-07-31).
Data as JSON: /data/errors/de177fb893a2ca82.json.
Report an issue: GitHub ↗.