apache/beam · error
no Google Cloud project specified. Use --project=
Error message
no Google Cloud project specified. Use --project=<project>
What it means
The Dataflow runner's getJobOptions requires a Google Cloud project to create the job. It first tries gcpopts.GetProjectFromFlagOrEnvironment (the --project flag or GOOGLE_CLOUD_PROJECT env var); when both are empty it returns this error before any API call is made.
Solutions
- Pass --project=<my-gcp-project> to the pipeline
- Export GOOGLE_CLOUD_PROJECT=my-gcp-project in the environment
- Verify the runner is really dataflow if you did not intend a GCP submission
Example fix
// before go run pipeline.go --runner=dataflow --region=us-central1 --staging_location=gs://b/s // after go run pipeline.go --runner=dataflow --project=my-gcp-project --region=us-central1 --staging_location=gs://b/s # or: export GOOGLE_CLOUD_PROJECT=my-gcp-project
Defensive patterns
Strategy: validation
Validate before calling
if os.Getenv("GOOGLE_CLOUD_PROJECT") == "" && projectFlag == "" {
return errors.New("set --project or GOOGLE_CLOUD_PROJECT")
} Prevention
- Export GOOGLE_CLOUD_PROJECT in shells and CI images
- Verify --runner=dataflow was intended before adding GCP flags
When it happens
Trigger: Executing a pipeline with runner=dataflow without --project=<project> and with the GOOGLE_CLOUD_PROJECT environment variable unset.
Common situations: Local shells or CI containers where GOOGLE_CLOUD_PROJECT is not exported; running the dataflow runner accidentally (misconfigured --runner) without GCP setup.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- no Google Cloud region specified. Use --region=
- failed to open file
- invalid staging location
- no GCS staging location specified. Use…
- bad I
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/7406886ec87cb019.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/go/pkg/beam/runners/dataflow/dataflow.go:272
}
return dataflowlib.Execute(ctx, model, opts, workerURL, modelURL, *endpoint, *jobopts.Async)
}
func isFlagPassed(name string) bool {
found := false
flag.Visit(func(f *flag.Flag) {
if f.Name == name {
found = true
}
})
return found
}
func getJobOptions(ctx context.Context, streaming bool) (*dataflowlib.JobOptions, error) {
project := gcpopts.GetProjectFromFlagOrEnvironment(ctx)
if project == "" {
return nil, errors.New("no Google Cloud project specified. Use --project=<project>")
}
region := gcpopts.GetRegion(ctx)
if region == "" {
return nil, errors.New("no Google Cloud region specified. Use --region=<region>. See https://cloud.google.com/dataflow/docs/concepts/regional-endpoints")
}
if *stagingLocation == "" {
return nil, errors.New("no GCS staging location specified. Use --staging_location=gs://<bucket>/<path>")
}
checkSoftDeletePolicyEnabled(ctx, *stagingLocation, "staging_location")
var jobLabels map[string]string
if *labels != "" {
if err := json.Unmarshal([]byte(*labels), &jobLabels); err != nil {
return nil, errors.Wrapf(err, "error reading --label flag as JSON")
}
}
View on GitHub (pinned to 12126d8942)