{"record":{"id":"a0e10310d24e5e65","repo":"apache/beam","slug":"unable-to-find-default-go-environment-with-id-q","errorCode":null,"errorMessage":"unable to find default Go environment with ID %q","messagePattern":"unable to find default Go environment with ID %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/translate.go","lineNumber":1510,"sourceCode":"\treturn fmt.Sprintf(\"e%v\", edge.ID())\n}\n\nfunc nodeID(n *graph.Node) string {\n\treturn fmt.Sprintf(\"n%v\", n.ID())\n}\n\nfunc scopeID(s *graph.Scope) string {\n\treturn fmt.Sprintf(\"s%v\", s.ID())\n}\n\n// UpdateDefaultEnvWorkerType is so runners can update the pipeline's default environment\n// with the correct artifact type and payload for the Go worker binary.\nfunc UpdateDefaultEnvWorkerType(typeUrn string, pyld []byte, p *pipepb.Pipeline) error {\n\t// Get the Go environment out.\n\tenvs := p.GetComponents().GetEnvironments()\n\tenv, ok := envs[defaultEnvId]\n\tif !ok {\n\t\treturn errors.Errorf(\"unable to find default Go environment with ID %q\", defaultEnvId)\n\t}\n\tfor _, dep := range env.GetDependencies() {\n\t\tif dep.RoleUrn != URNArtifactGoWorkerRole {\n\t\t\tcontinue\n\t\t}\n\t\tdep.TypeUrn = typeUrn\n\t\tdep.TypePayload = pyld\n\t\treturn nil\n\t}\n\treturn errors.Errorf(\"unable to find dependency with %q role in environment with ID %q,\", URNArtifactGoWorkerRole, defaultEnvId)\n}\n\n// UserStateCoderID returns the coder id of a user state\nfunc UserStateCoderID(ps state.PipelineState) string {\n\treturn fmt.Sprintf(\"val_%v\", ps.StateKey())\n}\n\n// UserStateKeyCoderID returns the key coder id of a user state","sourceCodeStart":1492,"sourceCodeEnd":1528,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/translate.go#L1492-L1528","documentation":"UpdateDefaultEnvWorkerType looks up the default Go environment (fixed defaultEnvId) in the pipeline's component map to swap in a worker artifact payload. This error is thrown when that environment entry is missing from the pipeline components.","triggerScenarios":"Calling UpdateDefaultEnvWorkerType (e.g. in custom worker binary/container injection paths) on a pipeline whose components.Environments map lacks the default Go environment ID.","commonSituations":"Mutating a pipeline proto produced/modified by another SDK or runner that renamed or removed the Go environment; a prior translation step dropped or re-IDed environments; running cross-language pipelines where the Go env was not embedded.","solutions":["Ensure the pipeline was built by the Go SDK so the default Go environment exists before calling UpdateDefaultEnvWorkerType.","Check the environments map (p.GetComponents().GetEnvironments()[defaultEnvId]) before mutating and log available env IDs.","Regenerate the pipeline proto with a matching Beam SDK version instead of hand-editing component IDs."],"exampleFix":"// before\nerr := graphx.UpdateDefaultEnvWorkerType(urn, payload, pipe)\n// after\nif _, ok := pipe.GetComponents().GetEnvironments()[\"go\"]; !ok {\n    return errors.New(\"pipeline has no default Go environment; rebuild with Go SDK\")\n}\nerr := graphx.UpdateDefaultEnvWorkerType(urn, payload, pipe)","handlingStrategy":"validation","validationCode":"if _, ok := pipe.GetComponents().GetEnvironments()[defaultEnvId]; !ok {\n    return errors.New(\"pipeline missing default Go environment; rebuild with Go SDK\")\n}","typeGuard":null,"tryCatchPattern":"if err := graphx.UpdateDefaultEnvWorkerType(urn, payload, pipe); err != nil {\n    log.Fatalf(\"worker payload injection failed: %v\", err)\n}","preventionTips":["Only call UpdateDefaultEnvWorkerType on pipelines produced by the Go SDK.","Log environment IDs when mutating pipeline protos.","Avoid hand-editing or re-IDing environments between translation stages."],"tags":["go","apache-beam","environment","pipeline-components"],"backgroundTag":"entity-not-found","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"}