{"record":{"id":"327ecf33a870e05d","repo":"apache/beam","slug":"empty-file-glob-provided","errorCode":null,"errorMessage":"empty file glob provided","messagePattern":"empty file glob provided","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/io/filesystem/filesystem.go","lineNumber":129,"sourceCode":"}\n\n// Renamer is an interface for renaming or moving files in the filesystem.\ntype Renamer interface {\n\tRename(ctx context.Context, oldpath, newpath string) error\n}\n\nfunc getScheme(path string) string {\n\tif index := strings.Index(path, \"://\"); index > 0 {\n\t\treturn path[:index]\n\t}\n\treturn \"default\"\n}\n\n// ValidateScheme panics if the given path's scheme does not have a\n// corresponding file system registered.\nfunc ValidateScheme(path string) {\n\tif strings.TrimSpace(path) == \"\" {\n\t\tpanic(\"empty file glob provided\")\n\t}\n\tscheme := getScheme(path)\n\tif _, ok := registry[scheme]; !ok {\n\t\tpanic(errorForMissingScheme(scheme, path))\n\t}\n}\n","sourceCodeStart":111,"sourceCodeEnd":136,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/io/filesystem/filesystem.go#L111-L136","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nfilesystem.MatchFiles(ctx, scope, inputGlob)\n// after\nif strings.TrimSpace(inputGlob) == \"\" {\n    log.Fatalf(\"--input file glob must be provided\")\n}\nfilesystem.MatchFiles(ctx, scope, inputGlob)","handlingStrategy":"validation","validationCode":"func requireNonEmptyGlob(path string) error {\n    if strings.TrimSpace(path) == \"\" {\n        return fmt.Errorf(\"file glob must be non-empty\")\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"defer func() { if r := recover(); r != nil { log.Fatalf(\"filesystem: %v\", r) } }()","preventionTips":["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"],"tags":["go","beam-io","panic","empty-path"],"backgroundTag":"empty-required-field","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}