{"record":{"id":"482258aeb746a4fd","repo":"apache/beam","slug":"experiment-worker-region-and-option-zone-are-mutually","errorCode":null,"errorMessage":"experiment worker_region and option Zone are mutually exclusive","messagePattern":"experiment worker_region and option Zone are mutually exclusive","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/runners/dataflow/dataflowlib/job.go","lineNumber":427,"sourceCode":"\t\treturn errors.New(\"workerRegion and workerZone options are mutually exclusive\")\n\t}\n\n\thasExperimentWorkerRegion := false\n\tfor _, experiment := range opts.Experiments {\n\t\tif strings.HasPrefix(experiment, \"worker_region\") {\n\t\t\thasExperimentWorkerRegion = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif hasExperimentWorkerRegion && opts.WorkerRegion != \"\" {\n\t\treturn errors.New(\"experiment worker_region and option workerRegion are mutually exclusive\")\n\t}\n\tif hasExperimentWorkerRegion && opts.WorkerZone != \"\" {\n\t\treturn errors.New(\"experiment worker_region and option workerZone are mutually exclusive\")\n\t}\n\tif hasExperimentWorkerRegion && opts.Zone != \"\" {\n\t\treturn errors.New(\"experiment worker_region and option Zone are mutually exclusive\")\n\t}\n\n\tif opts.Zone != \"\" {\n\t\tlog.Warn(ctx, \"Option --zone is deprecated. Please use --workerZone instead.\")\n\t\topts.WorkerZone = opts.Zone\n\t\topts.Zone = \"\"\n\t}\n\n\tnumWorkers := opts.NumWorkers\n\tmaxNumWorkers := opts.MaxNumWorkers\n\tif numWorkers < 0 {\n\t\treturn fmt.Errorf(\"num_workers (%d) cannot be negative\", numWorkers)\n\t}\n\tif maxNumWorkers < 0 {\n\t\treturn fmt.Errorf(\"max_num_workers (%d) cannot be negative\", maxNumWorkers)\n\t}\n\tif numWorkers > 0 && maxNumWorkers > 0 && numWorkers > maxNumWorkers {\n\t\treturn fmt.Errorf(\"num_workers (%d) cannot exceed max_num_workers (%d)\", numWorkers, maxNumWorkers)","sourceCodeStart":409,"sourceCodeEnd":445,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/dataflow/dataflowlib/job.go#L409-L445","documentation":"validateWorkerSettings rejects a job that enables the worker_region experiment while also setting the deprecated zone option. Regional placement declared via experiments cannot coexist with zonal placement via --zone.","triggerScenarios":"JobOptions.Experiments contains a string with prefix \"worker_region\" AND opts.Zone != \"\" during Translate. Note the zone check happens before zone is deprecated-normalized into WorkerZone.","commonSituations":"Old scripts using --experiment=worker_region=... plus legacy --zone; template merges keeping the deprecated flag.","solutions":["Remove --zone; if zonal placement is needed use --worker_zone (without the experiment).","If regional placement is needed, drop --zone and use the --worker_region option instead of the experiment.","Migrate away from both the experiment form and --zone to the single --worker_region option."],"exampleFix":"// before\n// --experiment=worker_region=us-central1 --zone=us-central1-a\n// after\n// --worker_region=us-central1   (regional) or --worker_zone=us-central1-a (zonal)","handlingStrategy":"validation","validationCode":"hasExp := false\nfor _, e := range opts.Experiments {\n    if strings.HasPrefix(e, \"worker_region\") { hasExp = true }\n}\nif hasExp && opts.Zone != \"\" {\n    opts.Zone = \"\" // legacy zone conflicts with regional experiment\n}","typeGuard":null,"tryCatchPattern":"if err := dataflowlib.ValidateWorkerSettings(ctx, opts); err != nil && strings.Contains(err.Error(), \"experiment worker_region and option Zone\") {\n    // drop legacy zone (or the experiment) and retry\n}","preventionTips":["Eliminate both legacy mechanisms: --zone and worker_region experiments.","Migrate to --worker_region (option form) for regional placement.","Grep launch scripts for \"--zone\" and \"worker_region=\" experiment flags."],"tags":["dataflow","gcp","configuration","deprecated-flag"],"backgroundTag":"mutually-exclusive-options","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"}