{"record":{"id":"61dc55f053aa176a","repo":"apache/beam","slug":"project-cannot-be-empty-got-v","errorCode":null,"errorMessage":"project cannot be empty, got %v","messagePattern":"project cannot be empty, got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/io/filesystem/gcs/gcs.go","lineNumber":167,"sourceCode":"\t\tclient, err = gcsx.NewUnauthenticatedClient(ctx)\n\t\tif err != nil {\n\t\t\tpanic(errors.Wrapf(err, \"failed to create GCS client\"))\n\t\t}\n\t}\n\treturn &fs{\n\t\tclient: client,\n\t}\n}\n\nfunc SetRequesterBillingProject(project string) {\n\tbillingProject = project\n}\n\n// RequesterBillingProject configure project to be used in google storage operations\n// with requester pays actived. More informaiton about requester pays in https://cloud.google.com/storage/docs/requester-pays\nfunc RequesterBillingProject(project string) error {\n\tif project == \"\" {\n\t\treturn fmt.Errorf(\"project cannot be empty, got %v\", project)\n\t}\n\t// The hook itself is defined in beam/core/runtime/harness/file_system_hooks.go\n\treturn hooks.EnableHook(projectBillingHook, project)\n}\n\nfunc (f *fs) Close() error {\n\treturn f.client.Close()\n}\n\nfunc (f *fs) List(ctx context.Context, glob string) ([]string, error) {\n\tbucket, object, err := gcsx.ParseObject(glob)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Compile the glob pattern to a regex. We use a custom glob-to-regex\n\t// translation that treats / as a regular character (not a separator),\n\t// since GCS object names are flat. This also supports ** for recursive","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/io/filesystem/gcs/gcs.go#L149-L185","documentation":"RequesterBillingProject configures the project billed for GCS requester-pays operations, and it rejects an empty project string. Since an empty billing project can never be valid for GCS API calls, the function fails fast with this error instead of deferring to a confusing GCS-side auth error.","triggerScenarios":"Calling RequesterBillingProject(\"\") — typically from an empty config value, unset flag, or an environment variable/env lookup that returned \"\".","commonSituations":"Flag/env not set in CI; config file key missing so the default empty string is passed; test code forgot to set the project.","solutions":["Pass a valid non-empty GCP project ID.","Guard before calling: check the value is non-empty and fail earlier with a clearer message.","Fix the source (flag, env var, config key) that produced the empty string.","Wire a sensible default project for the environment."],"exampleFix":"// before\nif err := gcs.RequesterBillingProject(project); err != nil { ... } // project == \"\"\n// after\nif project == \"\" {\n\treturn fmt.Errorf(\"billing project must be set via --gcs_billing_project\")\n}\nif err := gcs.RequesterBillingProject(project); err != nil { ... }","handlingStrategy":"validation","validationCode":"if project == \"\" {\n\treturn errors.New(\"GCS billing project must be a non-empty GCP project ID\")\n}\nreturn gcs.RequesterBillingProject(project)","typeGuard":null,"tryCatchPattern":"if err := gcs.RequesterBillingProject(project); err != nil {\n\tif strings.Contains(err.Error(), \"project cannot be empty\") {\n\t\treturn fmt.Errorf(\"set --gcs_billing_project: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Validate flags/env at startup before touching the Beam pipeline.","Fail fast with actionable messages naming the missing config key.","Set defaults per environment in config management.","Never pass config strings unchecked into RequesterBillingProject."],"tags":["go","apache-beam","gcs","config","validation"],"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"}