{"record":{"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/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/deploy/deployconfig/deployConfig.go#L66-L102","documentation":"Target.ParseIncludeExclude (deploy/deployconfig/deployConfig.go:82) compiles the target's Include field via hglob.GetGlob. This wraps a glob-parse failure. The Include field restricts which files a deployment target uploads.","triggerScenarios":"Setting `include` on a [[deployment.targets]] entry to a value hglob cannot parse (e.g. an unmatched bracket or other glob syntax error).","commonSituations":"Confusing glob and regex syntax in include; a bracket expression like '[abc' that is unclosed.","solutions":["Validate the Include value as a glob; prefer simple patterns like '**/*.css'.","Remember include/exclude are globs (hglob), not regex.","Balance any brackets/braces in the pattern."],"exampleFix":"# before\n[[deployment.targets]]\nname = \"cdn\"\ninclude = \"[assets\"   # unclosed bracket\n\n# after\n[[deployment.targets]]\nname = \"cdn\"\ninclude = \"assets/**\"","handlingStrategy":"validation","validationCode":"import \"github.com/gohugoio/hugo/hugofs/hglob\"\n\nfunc ValidateIncludeGlob(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 include/exclude as globs, not regex.","Lint include 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"}