{"id":"0c7753750ba8275c","repo":"gohugoio/hugo","slug":"invalid-deployment-target-include-q-v","errorCode":null,"errorMessage":"invalid deployment.target.include %q: %v","messagePattern":"invalid deployment\\.target\\.include %q: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deploy/deployconfig/deployConfig.go","lineNumber":84,"sourceCode":"\tInclude string\n\tExclude string\n\n\t// Parsed versions of Include/Exclude.\n\tIncludeGlob glob.Glob `json:\"-\"`\n\tExcludeGlob glob.Glob `json:\"-\"`\n\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","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/deploy/deployconfig/deployConfig.go#L66-L102","documentation":"During `hugo deploy` config decoding, each target's `include` pattern is compiled via `hglob.GetGlob` (github.com/gobwas/glob) in `Target.ParseIncludeExclude`; if compilation fails, the pattern string and the underlying glob error are wrapped into this error. Hugo validates globs up front so a bad pattern aborts before any files are uploaded.","triggerScenarios":"`hugo deploy` (or any DecodeConfig of the `deployment` section) with a target whose `include` value is an invalid gobwas/glob pattern — e.g. unbalanced `[` or `{`, like `include = \"**.{html,css\"`.","commonSituations":"Using regex syntax instead of glob syntax in the deployment config, unclosed brace/bracket groups, or copying gitignore-style patterns that aren't valid gobwas globs.","solutions":["Fix the glob syntax in the target's `include` setting — balance `{}`/`[]` groups, e.g. `\"**.{html,css}\"`.","Use glob syntax (`*`, `**`, `{a,b}`, `[abc]`), not regex — gobwas/glob is the matcher.","Test the pattern quickly with a small Go snippet or by re-running `hugo deploy --dryRun` after each fix."],"exampleFix":"# before\n[[deployment.targets]]\ninclude = \"**.{html,css\"\n# after\n[[deployment.targets]]\ninclude = \"**.{html,css}\"","handlingStrategy":"validation","validationCode":"if _, err := glob.Compile(includePattern); err != nil {\n    return fmt.Errorf(\"bad deployment.target.include %q: %w\", includePattern, err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Test include patterns with a glob library (gobwas/glob syntax) before committing config","Prefer simple patterns like `**.html` over complex nested braces","Run `hugo deploy --dryRun` after editing target patterns"],"tags":["hugo","hugo-deploy","glob","configuration","validation"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}