gohugoio/hugo · error
resource %T does not support resource.Source
Error message
resource %T does not support resource.Source
What it means
Emitted from pageState.renderResources (page.go:739). When publishing a page's non-Page resources, Hugo type-asserts each resource to resource.Source (the interface providing Publish()). If a resource does not satisfy that interface, the build aborts — a resource was attached to a page that has no notion of being published to the output filesystem.
Source
Thrown at hugolib/page.go:739
}
func (ps *pageState) renderResources() error {
for _, r := range ps.Resources() {
if _, ok := r.(page.Page); ok {
if !ps.s.h.BuildState.IsRebuild() {
// Pages gets rendered with the owning page but we count them here.
ps.s.PathSpec.ProcessingStats.Incr(&ps.s.PathSpec.ProcessingStats.Pages)
}
continue
}
if resources.IsPublished(r) {
continue
}
src, ok := r.(resource.Source)
if !ok {
return fmt.Errorf("resource %T does not support resource.Source", r)
}
if err := src.Publish(); err != nil {
if !herrors.IsNotExist(err) {
ps.s.Log.Errorf("Failed to publish Resource for page %q: %s", ps.pathOrTitle(), err)
}
} else {
ps.s.PathSpec.ProcessingStats.Incr(&ps.s.PathSpec.ProcessingStats.Files)
}
}
return nil
}
func (ps *pageState) AlternativeOutputFormats() page.OutputFormats {
f := ps.outputFormat()
var o page.OutputFormats
for _, of := range ps.OutputFormats() {View on GitHub (pinned to 52c9bd7908)
Solutions
- Inspect the %T in the message to learn which concrete resource type is missing Publish().
- Ensure any custom resource type implements resource.Source (Publish() error) in addition to resource.Resource.
- Update the Hugo module/wrapper that produced the resource to a compatible version.
Defensive patterns
Strategy: type-guard
Type guard
// for Go integrations injecting resources: ensure they satisfy resource.Source
func isPublishable(r resource.Resource) bool {
_, ok := r.(resource.Source) // requires Publish() error
return ok
} Prevention
- Custom resource types must implement resource.Source (Publish) for page bundles.
- Don't wrap/stripped resources in adapters that drop the Publish method.
- Inspect the %T in the message to find the offending type.
When it happens
Trigger: A custom resource type, or a constructed resource object that implements resource.Resource but not resource.Source, is present in a page's Resources() collection at publish time. Typically a programming/integration bug rather than an authoring mistake.
Common situations: Embedding Hugo as a library and injecting a custom resource; a resource adapter returning an incomplete type; a stale/incompatible Hugo module that wraps resources incorrectly.
Related errors
- must provide an URL and optionally an options map
- must provide one or more Resource objects to concat
- must provide a Resource object
- must not provide more arguments than Resource and hash algor
- resources.PostProcess cannot be used in a deferred template
AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09).
Data as JSON: /api/errors/70d2ee880a2b2ceb.
Report an issue: GitHub.