caddyserver/caddy · error

server block %v: compiling matcher sets: %v

Error message

server block %v: compiling matcher sets: %v

What it means

Error "server block %v: compiling matcher sets: %v" thrown in caddyserver/caddy.

Source

Thrown at caddyconfig/httpcaddyfile/httptype.go:770

					name := names[0]
					names = names[1:]
					if _, ok := srv.NamedRoutes[name]; ok {
						continue
					}
					if configuredNamedRoutes[name] == nil {
						return nil, fmt.Errorf("cannot invoke named route '%s', which was not defined", name)
					}
					srv.NamedRoutes[name] = configuredNamedRoutes[name]
					names = append(names, namedRouteInvokes[name]...)
				}
			}
		}

		// create a subroute for each site in the server block
		for _, sblock := range p.serverBlocks {
			matcherSetsEnc, err := st.compileEncodedMatcherSets(sblock)
			if err != nil {
				return nil, fmt.Errorf("server block %v: compiling matcher sets: %v", sblock.block.Keys, err)
			}

			hosts := sblock.hostsFromKeys(false)

			// emit warnings if user put unspecified IP addresses; they probably want the bind directive
			for _, h := range hosts {
				if h == "0.0.0.0" || h == "::" {
					caddy.Log().Named("caddyfile").Warn("Site block has an unspecified IP address which only matches requests having that Host header; you probably want the 'bind' directive to configure the socket", zap.String("address", h))
				}
			}

			// collect hosts that are forced to be automated
			forceAutomatedNames := make(map[string]struct{})
			if _, ok := sblock.pile["tls.force_automate"]; ok {
				for _, host := range hosts {
					forceAutomatedNames[host] = struct{}{}
				}
			}

View on GitHub (pinned to 50e54ee279)

Solutions

  1. Fix the matcher configuration in the referenced server block; the wrapped error identifies the specific matcher problem.

When it happens

Trigger: Thrown at caddyconfig/httpcaddyfile/httptype.go:770 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of caddyserver/caddy@50e54ee279 (2026-08-15). Data as JSON: /api/errors/309c0758c195f92c. Report an issue: GitHub.