{"record":{"id":"e35cd5e5ea9946bf","repo":"caddyserver/caddy","slug":"server-s-setting-up-route-matchers-v","errorCode":null,"errorMessage":"server %s: setting up route matchers: %v","messagePattern":"server (.+?): setting up route matchers: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddyhttp/autohttps.go","lineNumber":111,"sourceCode":"\t// Sort server names to ensure deterministic iteration.\n\t// This prevents race conditions where the order of server processing\n\t// could affect which server gets assigned the HTTP->HTTPS redirect listener.\n\tsrvNames := make([]string, 0, len(app.Servers))\n\tfor name := range app.Servers {\n\t\tsrvNames = append(srvNames, name)\n\t}\n\tslices.Sort(srvNames)\n\tfor _, srvName := range srvNames {\n\t\tsrv := app.Servers[srvName]\n\t\t// as a prerequisite, provision route matchers; this is\n\t\t// required for all routes on all servers, and must be\n\t\t// done before we attempt to do phase 1 of auto HTTPS,\n\t\t// since we have to access the decoded host matchers the\n\t\t// handlers will be provisioned later\n\t\tif srv.Routes != nil {\n\t\t\terr := srv.Routes.ProvisionMatchers(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"server %s: setting up route matchers: %v\", srvName, err)\n\t\t\t}\n\t\t}\n\n\t\t// prepare for automatic HTTPS\n\t\tif srv.AutoHTTPS == nil {\n\t\t\tsrv.AutoHTTPS = new(AutoHTTPSConfig)\n\t\t}\n\t\tif srv.AutoHTTPS.Disabled {\n\t\t\tlogger.Info(\"automatic HTTPS is completely disabled for server\", zap.String(\"server_name\", srvName))\n\t\t\tcontinue\n\t\t}\n\n\t\t// skip if all listeners use the HTTP port\n\t\tif !srv.listenersUseAnyPortOtherThan(app.httpPort()) {\n\t\t\tlogger.Warn(\"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server\",\n\t\t\t\tzap.String(\"server_name\", srvName),\n\t\t\t\tzap.Int(\"http_port\", app.httpPort()),\n\t\t\t)","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddyhttp/autohttps.go#L93-L129","documentation":"Automatic HTTPS phase 1 starts by provisioning all route matchers (ProvisionMatchers) for every server, because host matchers must be readable to determine which domains need certificates. If any matcher module fails to load or provision, this error names the server and wraps the cause. It runs before any cert decisions are made.","triggerScenarios":"Any matcher module error under servers.<name>.routes: unknown matcher module (missing plugin), malformed matcher JSON, or a matcher whose Provision fails (e.g. invalid regexp in path matcher, bad ACME match values).","commonSituations":"Custom matcher plugins not compiled in; regex syntax errors in path_regexp; migrating configs where a matcher option was renamed between versions.","solutions":["Read the wrapped matcher error and fix that matcher (module ID, regexp syntax, options)","Rebuild with the required plugin if the matcher comes from a custom module","Iterate with `caddy validate --config` — matcher provisioning is exercised there too"],"exampleFix":"// before\n{\"match\":[{\"host\":[\"example.com\"}],\"path\":[\"*[\"]}\n// after\n{\"match\":[{\"host\":[\"example.com\"}],\"path\":[\"/*\"]}","handlingStrategy":"validation","validationCode":"if err := caddy.Validate(cfgJSON); err != nil { return err } // provisions matchers via auto-HTTPS path","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Compile-test regexes in path_regexp/host_regexp matchers before deploy","Keep matcher plugin requirements in sync with the xcaddy build","`caddy validate` catches matcher provisioning errors without binding ports"],"tags":["caddy","matchers","auto-https","provisioning","config"],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}