gohugoio/hugo · critical

no site found for matrix %s

Error message

no site found for matrix %s

What it means

An internal panic in HugoSites.resolveFirstSite (hugolib/hugo_sites.go:268) when no configured site matches any vector in the given VectorStore. resolveFirstSite iterates every vector and looks it up in sitesVersionsRolesMap; if none match, the content's site dimensions (language/version/role) have no corresponding Site.

Source

Thrown at hugolib/hugo_sites.go:268

func (h *HugoSites) Close() error {
	return h.Deps.Close()
}

func (h *HugoSites) isRebuild() bool {
	return h.BuildState.IsRebuild()
}

func (h *HugoSites) resolveFirstSite(matrix sitesmatrix.VectorStore) *Site {
	var s *Site
	var ok bool
	matrix.ForEachVector(func(v sitesmatrix.Vector) bool {
		if s, ok = h.sitesVersionsRolesMap[v]; ok {
			return false
		}
		return true
	})
	if s == nil {
		panic(fmt.Sprintf("no site found for matrix %s", matrix))
	}

	return s
}

type buildCounters struct {
	contentRenderCounter atomic.Uint64
	pageRenderCounter    atomic.Uint64
}

func (c *buildCounters) loggFields() logg.Fields {
	return logg.Fields{
		{Name: "pages", Value: c.pageRenderCounter.Load()},
		{Name: "content", Value: c.contentRenderCounter.Load()},
	}
}

type fatalErrorHandler struct {

View on GitHub (pinned to 52c9bd7908)

Solutions

  1. Declare the language/version in hugo config before adding content for it
  2. Verify [languages] and versions configuration matches content front matter
  3. Report a Hugo bug if all configured languages appear to be present
Defensive patterns

Strategy: validation

Validate before calling

// Internal: verify a site exists for the matrix before resolving.
found := false
matrix.ForEachVector(func(v sitesmatrix.Vector) bool {
    if _, ok := h.sitesVersionsRolesMap[v]; ok {
        found = true
        return false
    }
    return true
})
if !found {
    return errors.New("no site configured for the given matrix")
}

Prevention

When it happens

Trigger: Content carries a site vector (language or version) that is not declared in the site matrix during a build or partial rebuild.

Common situations: Adding content for a language/version not declared in config; a misconfigured [languages]/versions matrix; an internal bookkeeping error during incremental rebuilds.

Related errors


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