{"record":{"id":"4dcca3d62fe20598","repo":"apache/beam","slug":"experiment-worker-region-and-option-workerzone-are-mutually","errorCode":null,"errorMessage":"experiment worker_region and option workerZone are mutually exclusive","messagePattern":"experiment worker_region and option workerZone are mutually exclusive","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/runners/dataflow/dataflowlib/job.go","lineNumber":424,"sourceCode":"\t\treturn errors.New(\"cannot use option zone with workerZone; prefer workerZone\")\n\t}\n\tif opts.WorkerZone != \"\" && opts.WorkerRegion != \"\" {\n\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)","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/dataflow/dataflowlib/job.go#L406-L442","documentation":"validateWorkerSettings rejects a job that enables the worker_region experiment while also setting the workerZone option. Zonal placement via workerZone conflicts with declaring a worker region through the experiments mechanism.","triggerScenarios":"JobOptions.Experiments contains a string with prefix \"worker_region\" AND opts.WorkerZone != \"\" during Translate.","commonSituations":"Launcher adds --experiment=worker_region=... while the job also specifies --worker_zone=us-central1-a; mixed legacy/new flag sets in the same pipeline config.","solutions":["Remove the worker_region experiment and keep --worker_zone for zonal placement.","Or, if regional placement is intended, drop --worker_zone and use the --worker_region option instead of the experiment.","Decide regional vs zonal placement once and set only one mechanism."],"exampleFix":"// before\n// --experiment=worker_region=us-central1 --worker_zone=us-central1-a\n// after\n// --worker_zone=us-central1-a","handlingStrategy":"validation","validationCode":"hasExp := false\nfor _, e := range opts.Experiments {\n    if strings.HasPrefix(e, \"worker_region\") { hasExp = true }\n}\nif hasExp && opts.WorkerZone != \"\" {\n    // zonal requested: strip the regional experiment\n    filtered := opts.Experiments[:0]\n    for _, e := range opts.Experiments { if !strings.HasPrefix(e, \"worker_region\") { filtered = append(filtered, e) } }\n    opts.Experiments = filtered\n}","typeGuard":null,"tryCatchPattern":"if err := dataflowlib.ValidateWorkerSettings(ctx, opts); err != nil && strings.Contains(err.Error(), \"experiment worker_region and option workerZone\") {\n    // remove the experiment and retry with worker_zone\n}","preventionTips":["Decide regional vs zonal placement before building JobOptions.","Never combine the worker_region experiment with zone-based options.","Strip worker_region experiments when migrating to worker_zone."],"tags":["dataflow","gcp","configuration","experiments"],"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"}