{"record":{"id":"bf1124cc6390e243","repo":"GoogleContainerTools/skaffold","slug":"glob-w","errorCode":null,"errorMessage":"glob: %w","messagePattern":"glob: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/util/util.go","lineNumber":95,"sourceCode":"// Returns a list of unique files that match the glob patterns passed in.\nfunc ExpandPathsGlob(workingDir string, paths []string) ([]string, error) {\n\tvar set orderedFileSet\n\n\tfor _, p := range paths {\n\t\tpath := p\n\t\tif !filepath.IsAbs(path) {\n\t\t\tpath = filepath.Join(workingDir, path)\n\t\t}\n\n\t\tif _, err := os.Stat(path); err == nil {\n\t\t\t// This is a file reference, so just add it\n\t\t\tset.Add(path)\n\t\t\tcontinue\n\t\t}\n\n\t\tfiles, err := filepath.Glob(path)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"glob: %w\", err)\n\t\t}\n\t\tif len(files) == 0 {\n\t\t\tlog.Entry(context.TODO()).Warnf(\"%s did not match any file\", p)\n\t\t}\n\n\t\tfor _, f := range files {\n\t\t\tif err := walk.From(f).WhenIsFile().Do(func(path string, _ walk.Dirent) error {\n\t\t\t\tset.Add(path)\n\t\t\t\treturn nil\n\t\t\t}); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"filepath walk: %w\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn set.Files(), nil\n}\n","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/util/util.go#L77-L113","documentation":"ExpandPathsGlob expands each pattern in its input with filepath.Glob; this error wraps a non-nil error returned by filepath.Glob itself. Glob only errors on malformed patterns (e.g. unbalanced [ or bad character-class syntax), not on zero matches — no matches produce a warning and an empty result instead. It propagates from manifest dependency resolution and test dependency discovery.","triggerScenarios":"Passing a syntactically invalid glob pattern in the paths list — e.g. `foo[bar` (unclosed bracket), `[]]` misuse, or an otherwise malformed pattern — via kustomize/kubectl manifest configs, test configuration paths, or remote/local manifest resolution.","commonSituations":"Users hand-editing skaffold.yaml and typos a glob bracket; config templating (envsubst/Helm) injecting an empty or broken pattern; copying Windows-style patterns with stray characters.","solutions":["Fix the malformed glob pattern in skaffold.yaml (check for unbalanced `[`/`]` or invalid character ranges).","Escape literal brackets that are part of a filename (e.g. `foo\\[bar\\]`).","Print/echo the expanded config (`skaffold diagnose`) to see the actual pattern being passed.","If the pattern is template-generated, validate the rendered pattern with filepath.Glob in isolation before wiring it into config."],"exampleFix":"// before (skaffold.yaml)\ntest:\n  - image: app\n    structureTests: [\"tests/st[\" ]   # malformed pattern\n// after\ntest:\n  - image: app\n    structureTests: [\"tests/st*.json\"]","handlingStrategy":"validation","validationCode":"for _, p := range paths {\n    if strings.ContainsAny(p, \"[\") && !strings.HasSuffix(p, \"]\") {\n        return fmt.Errorf(\"malformed glob pattern %q: unbalanced bracket\", p)\n    }\n    if _, err := filepath.Glob(p); err != nil {\n        return fmt.Errorf(\"invalid pattern %q: %w\", p, err)\n    }\n}","typeGuard":null,"tryCatchPattern":"deps, err := util.ExpandPathsGlob(fs, paths)\nif err != nil {\n    if strings.Contains(err.Error(), \"glob:\") {\n        return fmt.Errorf(\"check skaffold.yaml glob patterns: %w\", err)\n    }\n    return err\n}","preventionTips":["Validate glob syntax in skaffold.yaml before runs (balanced brackets, valid ranges).","Avoid template variables that can expand to empty strings inside patterns.","Escape literal [ ] in filenames.","Run `skaffold diagnose` to inspect the resolved patterns."],"tags":["glob","filepath","pattern","config"],"backgroundTag":"bad-glob-pattern","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}