{"record":{"id":"d98c5269fe714adf","repo":"apache/beam","slug":"both-worker-harness-container-image-and-sdk-container-image","errorCode":null,"errorMessage":"Both worker_harness_container_image and sdk_container_image cannot both be set. Prefer sdk_container_image, worker_harness_container_image is deprecated.","messagePattern":"Both worker_harness_container_image and sdk_container_image cannot both be set\\. Prefer sdk_container_image, worker_harness_container_image is deprecated\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/runners/dataflow/dataflow.go","lineNumber":456,"sourceCode":"\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Invalid hook configuration for gcsRecorderHook: %s\", opts))\n\t}\n\n\treturn func(ctx context.Context, spec string, r io.Reader) error {\n\t\tclient, err := gcsx.NewClient(ctx, storage.ScopeReadWrite)\n\t\tif err != nil {\n\t\t\treturn errors.WithContext(err, \"establishing GCS client\")\n\t\t}\n\t\treturn gcsx.WriteObject(ctx, client, bucket, path.Join(prefix, spec), r)\n\t}\n}\n\nfunc getContainerImage(ctx context.Context) string {\n\turn := jobopts.GetEnvironmentUrn(ctx)\n\tif urn == \"\" || urn == \"beam:env:docker:v1\" {\n\t\tif *workerHarnessImage != \"\" {\n\t\t\tif *image != \"\" {\n\t\t\t\tpanic(\"Both worker_harness_container_image and sdk_container_image cannot both be set. Prefer sdk_container_image, worker_harness_container_image is deprecated.\")\n\t\t\t}\n\t\t\treturn *workerHarnessImage\n\t\t}\n\t\tif *image != \"\" {\n\t\t\treturn *image\n\t\t}\n\t\tenvConfig := jobopts.GetEnvironmentConfig(ctx)\n\t\tif envConfig == core.DefaultDockerImage {\n\t\t\t// It's possible the user set the image exactly manually, but unlikely.\n\t\t\t// Prefer using the gcr.io image by default.\n\t\t\t// Note: This doesn't change the dev experience, which requires a user\n\t\t\t// to have a dev image.\n\t\t\t// However, RC versions should automatically be picked up, since\n\t\t\t// they are never tagged the RC number, just the main version.\n\t\t\treturn \"gcr.io/cloud-dataflow/v1beta3/beam_go_sdk:\" + core.SdkVersion\n\t\t}\n\t\treturn envConfig\n\t}","sourceCodeStart":438,"sourceCodeEnd":474,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/dataflow/dataflow.go#L438-L474","documentation":"getContainerImage enforces that only one of the deprecated worker_harness_container_image flag and the newer sdk_container_image flag is supplied. Setting both is ambiguous, so the function panics and asks the user to prefer sdk_container_image.","triggerScenarios":"Launching a Dataflow job with both --worker_harness_container_image and --sdk_container_image set to non-empty values.","commonSituations":"Migrating old job-launch scripts that still pass the deprecated flag while templating/pipeline code adds the new one, or CI configs accumulating both flags over time.","solutions":["Remove --worker_harness_container_image and keep only --sdk_container_image","If both come from different config layers, unset the deprecated flag in the launch script or template","Search the job submission code/Makefile/CI for worker_harness_container_image and delete it","Update documentation/templates to reference sdk_container_image only"],"exampleFix":"// before\ngo run . --worker_harness_container_image=gcr.io/x/y:1 --sdk_container_image=gcr.io/x/y:2\n// after\ngo run . --sdk_container_image=gcr.io/x/y:2","handlingStrategy":"validation","validationCode":"if workerHarnessImage != \"\" && sdkContainerImage != \"\" {\n    return errors.New(\"set only --sdk_container_image\")\n}","typeGuard":null,"tryCatchPattern":"func buildArgs(flags map[string]string) error {\n    if flags[\"worker_harness_container_image\"] != \"\" && flags[\"sdk_container_image\"] != \"\" {\n        return errors.New(\"mutually exclusive flags: keep sdk_container_image\")\n    }\n    return nil\n}","preventionTips":["Migrate all job configs to sdk_container_image only","Grep launch scripts/CI for worker_harness_container_image","Centralize Dataflow flag construction in one helper","Remove deprecated flags when upgrading Beam versions"],"tags":["dataflow","flags","deprecation"],"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"}