gohugoio/hugo · error

partial not found

Error message

partial %q not found

What it means

Thrown by partials.lookup when TemplateStore.LookupPartial returns nil for the given name. Since Hugo 0.146.0 the partials/ prefix is stripped automatically; including it only triggers a warning, but a truly unknown name raises this error.

Solutions

  1. Verify the file exists at layouts/partials/<name>.html (do not include the 'partials/' prefix in the call).
  2. Check for typos and case sensitivity in the partial name.
  3. Run hugo with --templateMetrics to list resolved/missing templates.
  4. If using a theme, confirm the theme is set in config and the partial ships with it.

Example fix

// before (missing file, typo):
{{ partial "headder.html" . }}
// after:
{{ partial "header.html" . }}
Defensive patterns

Strategy: validation

Validate before calling

{{ if templates.Exists "partials/my/partial.html" }}
  {{ partial "my/partial" . }}
{{ else }}
  {{ warnf "partial not found" }}
{{ end }}

Prevention

When it happens

Trigger: Calling {{ partial "my/partial" . }} or {{ partialCached "my/partial" . }} where no template exists at layouts/partials/my/partial.html (or .tpl, or under _partials/).

Common situations: Typo in the partial name, missing .html file extension in the filename, partial file placed outside layouts/partials/, case mismatch on case-sensitive filesystems, or referencing a partial from a theme that isn't installed/configured. Common after renaming or moving partial files.

Related errors


AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09). Data as JSON: /api/errors/f559b9d373cd4280. Report an issue: GitHub.

Appendix: source

Thrown at tpl/partials/partials.go:140

}

func (ns *Namespace) include(ctx context.Context, name string, dataList ...any) includeResult {
	v, err := ns.lookup(name)
	if err != nil {
		return includeResult{err: err}
	}
	return ns.doInclude(ctx, "", v, dataList...)
}

func (ns *Namespace) lookup(name string) (*tplimpl.TemplInfo, error) {
	if strings.HasPrefix(name, "partials/") {
		// This is most likely not what the user intended.
		// This worked before Hugo 0.146.0.
		ns.deps.Log.Warnidf(constants.WarnPartialSuperfluousPrefix, "Doubtful use of partial function in {{ partial \"%s\"}}), this is most likely not what you want. Consider removing superfluous prefix \"partials/\" from template name given as first function argument.", name)
	}
	v := ns.deps.TemplateStore.LookupPartial(name)
	if v == nil {
		return nil, fmt.Errorf("partial %q not found", name)
	}
	return v, nil
}

// include is a helper function that lookups and executes the named partial.
// Returns the final template name and the rendered output.
func (ns *Namespace) doInclude(ctx context.Context, key string, templ *tplimpl.TemplInfo, dataList ...any) includeResult {
	if templ.ParseInfo.HasPartialInner {
		stack := tpl.Context.PartialDecoratorIDStack.Get(ctx)
		if stack != nil {
			if id, ok := stack.Peek(); ok {
				// Signal that inner exists.
				id.Bool = true
			}
		}
	}
	var data any
	if len(dataList) > 0 {

View on GitHub (pinned to 52c9bd7908)