apache/beam · error
no files matching pattern
Error message
no files matching pattern %q
What it means
fileio.MatchAll's ProcessElement expands the glob against the filesystem and, when zero files match and EmptyTreatment does not allow an empty match, fails with this error. It exists to surface likely-mistyped paths/permissions instead of silently producing an empty pipeline.
Solutions
- Fix the glob pattern — test it with filesystem.Match or gsutil/ls locally against the same paths
- Set EmptyTreatment: fileio.EmptyTreatmentAllow in the MatchAll options when an empty match is legitimate
- Verify the upstream job that produces the files completed and wrote to the expected location
- Check filesystem/permissions: the worker must be able to list the containing directory
Example fix
// before matches := fileio.MatchAll(s, fileio.MatchAllEmptyTreatment(0), glob) // after: allow legitimately empty matches matches := fileio.MatchAll(s, fileio.MatchAllEmptyTreatment(fileio.EmptyTreatmentAllow), glob)
Defensive patterns
Strategy: fallback
Validate before calling
matched, _ := fs.List(context.Background(), pattern)
if len(matched) == 0 {
// verify upstream producer ran, or switch EmptyTreatment to Allow
} Try / catch
defer func() {
if r := recover(); r != nil {
log.Printf("glob %q matched nothing; check upstream producer or EmptyTreatmentAllow", glob)
}
}() Prevention
- Test globs locally with filesystem.Match against the real store before running the pipeline
- Use EmptyTreatmentAllow when an empty input is a valid state (e.g. hourly partitions)
- Verify the upstream job finished and paths exist from the worker's network/permissions
When it happens
Trigger: len(files) == 0 after Match(ctx, fs, glob) and allowEmptyMatch(glob, fn.EmptyTreatment) is false (match.go:152) — i.e. EmptyTreatment is EmptyTreatmentDisallow (default) or EmptyTreatmentIfNonEmptyMatch semantics.
Common situations: Typo in the glob or path; input directory empty because the upstream producer hasn't run; files stored on a filesystem view the worker can't see (wrong container/FS registration); date-partitioned path for the wrong day.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Delete operation failed
- error getting last modified time for
- errorForMissingScheme(scheme, path)
- File spec not found
- List operation failed
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/1dac8269d1e630bf.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/go/pkg/beam/io/fileio/match.go:152
) error {
if strings.TrimSpace(glob) == "" {
return nil
}
fs, err := filesystem.New(ctx, glob)
if err != nil {
return err
}
defer fs.Close()
files, err := fs.List(ctx, glob)
if err != nil {
return err
}
if len(files) == 0 {
if !allowEmptyMatch(glob, fn.EmptyTreatment) {
return fmt.Errorf("no files matching pattern %q", glob)
}
return nil
}
metadata, err := metadataFromFiles(ctx, fs, files)
if err != nil {
return err
}
for _, md := range metadata {
emit(md)
}
return nil
}
func allowEmptyMatch(glob string, treatment emptyTreatment) bool {
switch treatment {View on GitHub (pinned to 12126d8942)