{"record":{"id":"83808f415e07bab2","repo":"gohugoio/hugo","slug":"empty-deployment-matcher","errorCode":null,"errorMessage":"empty deployment matcher","messagePattern":"empty deployment matcher","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deploy/deployconfig/deployConfig.go","lineNumber":163,"sourceCode":"\t\treturn dcfg, err\n\t}\n\n\tif dcfg.Workers <= 0 {\n\t\tdcfg.Workers = 10\n\t}\n\n\tfor _, tgt := range dcfg.Targets {\n\t\tif *tgt == (Target{}) {\n\t\t\treturn dcfg, errors.New(\"empty deployment target\")\n\t\t}\n\t\tif err := tgt.ParseIncludeExclude(); err != nil {\n\t\t\treturn dcfg, err\n\t\t}\n\t}\n\tvar err error\n\tfor _, m := range dcfg.Matchers {\n\t\tif *m == (Matcher{}) {\n\t\t\treturn dcfg, errors.New(\"empty deployment matcher\")\n\t\t}\n\t\tm.Re, err = regexp.Compile(m.Pattern)\n\t\tif err != nil {\n\t\t\treturn dcfg, fmt.Errorf(\"invalid deployment.matchers.pattern: %v\", err)\n\t\t}\n\t}\n\tfor _, o := range dcfg.Order {\n\t\tre, err := regexp.Compile(o)\n\t\tif err != nil {\n\t\t\treturn dcfg, fmt.Errorf(\"invalid deployment.orderings.pattern: %v\", err)\n\t\t}\n\t\tdcfg.Ordering = append(dcfg.Ordering, re)\n\t}\n\n\treturn dcfg, nil\n}\n","sourceCodeStart":145,"sourceCodeEnd":180,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/deploy/deployconfig/deployConfig.go#L145-L180","documentation":"Each entry in deployment.matchers is compared to the zero-value Matcher{}. An entry with no fields at all (no pattern, no cacheControl, etc.) is rejected. A matcher that has a pattern is fine even if other fields are unset.","triggerScenarios":"A `[[deployment.matchers]]` table with no keys, leaving a completely empty matcher.","commonSituations":"Placeholder matcher left in config; indentation/formatting error producing an empty map; stub added while drafting CDN header rules.","solutions":["Give every [[deployment.matchers]] entry at least a `pattern` plus the headers/Cache-Control you want.","Remove empty/placeholder matcher entries.","Check config indentation so each matcher decodes with its fields."],"exampleFix":"// before\n[[deployment.matchers]]\n# (no fields)\n// after\n[[deployment.matchers]]\npattern = \".+\\\\.js$\"\nCache-Control = \"public, max-age=31536000\"","handlingStrategy":"validation","validationCode":"// Reject empty matcher entries before deploying\nfor _, m := range matchers {\n    if m == (Matcher{}) {\n        return errors.New(\"empty deployment matcher found; add a pattern\")\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give every [[deployment.matchers]] entry at least a pattern.","Remove placeholder matcher stubs.","Validate config indentation so matchers decode correctly."],"tags":["hugo","deploy","config"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}