GoogleContainerTools/skaffold · error
glob: %w
Error message
glob: %w
What it means
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.
Source
Thrown at pkg/skaffold/util/util.go:95
// Returns a list of unique files that match the glob patterns passed in.
func ExpandPathsGlob(workingDir string, paths []string) ([]string, error) {
var set orderedFileSet
for _, p := range paths {
path := p
if !filepath.IsAbs(path) {
path = filepath.Join(workingDir, path)
}
if _, err := os.Stat(path); err == nil {
// This is a file reference, so just add it
set.Add(path)
continue
}
files, err := filepath.Glob(path)
if err != nil {
return nil, fmt.Errorf("glob: %w", err)
}
if len(files) == 0 {
log.Entry(context.TODO()).Warnf("%s did not match any file", p)
}
for _, f := range files {
if err := walk.From(f).WhenIsFile().Do(func(path string, _ walk.Dirent) error {
set.Add(path)
return nil
}); err != nil {
return nil, fmt.Errorf("filepath walk: %w", err)
}
}
}
return set.Files(), nil
}
View on GitHub (pinned to a1189de023)
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.
Example fix
// before (skaffold.yaml)
test:
- image: app
structureTests: ["tests/st[" ] # malformed pattern
// after
test:
- image: app
structureTests: ["tests/st*.json"] Defensive patterns
Strategy: validation
Validate before calling
for _, p := range paths {
if strings.ContainsAny(p, "[") && !strings.HasSuffix(p, "]") {
return fmt.Errorf("malformed glob pattern %q: unbalanced bracket", p)
}
if _, err := filepath.Glob(p); err != nil {
return fmt.Errorf("invalid pattern %q: %w", p, err)
}
} Try / catch
deps, err := util.ExpandPathsGlob(fs, paths)
if err != nil {
if strings.Contains(err.Error(), "glob:") {
return fmt.Errorf("check skaffold.yaml glob patterns: %w", err)
}
return err
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- invalid glob pattern: %w
- failed to evaluate pod name pattern %q due to error %w
- failed to evaluate container name pattern %q due to error %w
- pattern error for %q: %w
- bucket name is empty
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/bf1124cc6390e243.
Report an issue: GitHub.