{"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/8a468df065a75c1c7cf9f6850f32148746590ea5/deploy/deployconfig/deployConfig.go#L72-L108","documentation":"The exclude-side twin of error 367: `Target.ParseIncludeExclude` compiles the target's `exclude` string with `hglob.GetGlob` and returns this wrapped error when the pattern is not a valid gobwas/glob expression. Deployment aborts at config-decode time rather than mid-upload.","triggerScenarios":"`hugo deploy` with a deployment target whose `exclude` value fails gobwas/glob compilation — unbalanced `{`/`[`, or otherwise malformed pattern like `exclude = \"**/[draft\"`.","commonSituations":"Trying to exclude multiple extensions with malformed brace groups, using regex or gitignore syntax, or shell-quoting issues that truncate the pattern in the config file.","solutions":["Correct the glob in the target's `exclude` setting — e.g. `\"**.{gif,jpg}\"` with the closing brace.","Stick to gobwas/glob syntax; separate alternatives with commas inside `{}` and close all groups.","Verify with `hugo deploy --dryRun` before a real deploy."],"exampleFix":"# before\n[[deployment.targets]]\nexclude = \"**.[jpg\"\n# after\n[[deployment.targets]]\nexclude = \"**.{jpg,gif}\"","handlingStrategy":"validation","validationCode":"if _, err := glob.Compile(excludePattern); err != nil {\n    return fmt.Errorf(\"bad deployment.target.exclude %q: %w\", excludePattern, err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Compile-check exclude globs the same way as includes before deploying","Escape or avoid glob metacharacters that aren't intended as wildcards","Cover deployment config with a config-validation step in CI"],"tags":["hugo","hugo-deploy","glob","configuration","validation"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}