{"record":{"id":"6c5234985bb510b2","repo":"gohugoio/hugo","slug":"invalid-deployment-target-exclude-q-v","errorCode":null,"errorMessage":"invalid deployment.target.exclude %q: %v","messagePattern":"invalid deployment\\.target\\.exclude %q: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deploy/deployconfig/deployConfig.go","lineNumber":90,"sourceCode":"\n\t// If true, any local path matching <dir>/index.html will be mapped to the\n\t// remote path <dir>/. This does not affect the top-level index.html file,\n\t// since that would result in an empty path.\n\tStripIndexHTML bool\n}\n\nfunc (tgt *Target) ParseIncludeExclude() error {\n\tvar err error\n\tif tgt.Include != \"\" {\n\t\ttgt.IncludeGlob, err = hglob.GetGlob(tgt.Include)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid deployment.target.include %q: %v\", tgt.Include, err)\n\t\t}\n\t}\n\tif tgt.Exclude != \"\" {\n\t\ttgt.ExcludeGlob, err = hglob.GetGlob(tgt.Exclude)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid deployment.target.exclude %q: %v\", tgt.Exclude, err)\n\t\t}\n\t}\n\treturn nil\n}\n\n// Matcher represents configuration to be applied to files whose paths match\n// a specified pattern.\ntype Matcher struct {\n\t// Pattern is the string pattern to match against paths.\n\t// Matching is done against paths converted to use / as the path separator.\n\tPattern string\n\n\t// CacheControl specifies caching attributes to use when serving the blob.\n\t// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control\n\tCacheControl string\n\n\t// ContentEncoding specifies the encoding used for the blob's content, if any.\n\t// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/deploy/deployconfig/deployConfig.go#L72-L108","documentation":"Symmetric to Include: Target.ParseIncludeExclude (deploy/deployconfig/deployConfig.go:88) compiles the target's Exclude field via hglob.GetGlob and wraps a parse failure. The Exclude field removes files from a target's upload set.","triggerScenarios":"Setting `exclude` on a [[deployment.targets]] entry to a value hglob cannot parse (unclosed bracket, malformed brace expansion, etc.).","commonSituations":"Confusing glob and regex syntax in exclude; an unclosed character class.","solutions":["Validate the Exclude value as a glob; prefer simple patterns like '**/*.map'.","Remember include/exclude are globs (hglob), not regex.","Balance any brackets/braces in the pattern."],"exampleFix":"# before\n[[deployment.targets]]\nname = \"cdn\"\nexclude = \"(*.map\"   # unbalanced paren\n\n# after\n[[deployment.targets]]\nname = \"cdn\"\nexclude = \"**/*.map\"","handlingStrategy":"validation","validationCode":"import \"github.com/gohugoio/hugo/hugofs/hglob\"\n\nfunc ValidateExcludeGlob(pattern string) error {\n    if pattern == \"\" { return nil }\n    _, err := hglob.GetGlob(pattern)\n    return err\n}","typeGuard":null,"tryCatchPattern":"if err := tgt.ParseIncludeExclude(); err != nil {\n    return err\n}","preventionTips":["Treat exclude as a glob, not regex.","Lint exclude patterns in CI with hglob.GetGlob.","Prefer simple '**/...' patterns."],"tags":["deploy","config","glob"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}