apache/beam · error
empty file glob provided
Error message
empty file glob provided
What it means
This panic is thrown by filesystem.ValidateScheme when the path (or file glob) passed to a filesystem-backed Beam I/O operation is an empty or whitespace-only string. Before dispatching to a registered filesystem implementation, Beam extracts the scheme from the path and validates it; an empty string has no scheme, so the library fails fast. It is a programmer error, not a runtime condition.
Solutions
- Ensure the file path/glob variable is non-empty before calling Read/Write/MatchFiles, e.g. fail early on flags with a default
- Trim and check user-supplied paths: strings.TrimSpace(path) == ""
- Provide a sensible default glob in your pipeline flag parsing
- Log the variable source (flag/env/config) that produced the empty string
Example fix
// before
filesystem.MatchFiles(ctx, scope, inputGlob)
// after
if strings.TrimSpace(inputGlob) == "" {
log.Fatalf("--input file glob must be provided")
}
filesystem.MatchFiles(ctx, scope, inputGlob) Defensive patterns
Strategy: validation
Validate before calling
func requireNonEmptyGlob(path string) error {
if strings.TrimSpace(path) == "" {
return fmt.Errorf("file glob must be non-empty")
}
return nil
} Try / catch
defer func() { if r := recover(); r != nil { log.Fatalf("filesystem: %v", r) } }() Prevention
- Validate path flags in flag parsing with a required-flag check
- Default file globs in config should be checked at startup
- Add a unit test asserting inputs to MatchFiles/Read are non-empty
When it happens
Trigger: Calling beam/filesystem functions like filesystem.Read, Write, MatchFiles, MatchContinuously, TestFilesystem, or ReadWithFilename with a "" or " " path, typically because a variable holding the file pattern was never set or an option/flag was left empty.
Common situations: Pipeline options or flags like --input not provided and defaulting to empty string; a templated glob built from an empty prefix; config file missing the file pattern key.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- errorForMissingScheme(scheme, path)
- AfterProcessingTime trigger set without a delay or…
- At least one subtrigger required for composite triggers.
- attempted to add namespace to missing coder id
- attempted to add namespace to missing windowing strategy id
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/327ecf33a870e05d.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/go/pkg/beam/io/filesystem/filesystem.go:129
}
// Renamer is an interface for renaming or moving files in the filesystem.
type Renamer interface {
Rename(ctx context.Context, oldpath, newpath string) error
}
func getScheme(path string) string {
if index := strings.Index(path, "://"); index > 0 {
return path[:index]
}
return "default"
}
// ValidateScheme panics if the given path's scheme does not have a
// corresponding file system registered.
func ValidateScheme(path string) {
if strings.TrimSpace(path) == "" {
panic("empty file glob provided")
}
scheme := getScheme(path)
if _, ok := registry[scheme]; !ok {
panic(errorForMissingScheme(scheme, path))
}
}
View on GitHub (pinned to 12126d8942)