{"record":{"id":"b71bfab9c9ee58f5","repo":"apache/beam","slug":"attempted-to-add-namespace-to-missing-coder-id-v-not-in-v","errorCode":null,"errorMessage":"attempted to add namespace to missing coder id: %v not in %v","messagePattern":"attempted to add namespace to missing coder id: (.+?) not in (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"sdks/go/pkg/beam/core/runtime/xlangx/namespace.go","lineNumber":32,"sourceCode":"// limitations under the License.\n\npackage xlangx\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/apache/beam/sdks/v2/go/pkg/beam/internal/errors\"\n\tpipepb \"github.com/apache/beam/sdks/v2/go/pkg/beam/model/pipeline_v1\"\n)\n\nfunc addCoderID(c *pipepb.Components, idMap map[string]string, cid string, newID func(string) string) string {\n\tif _, exists := idMap[cid]; exists {\n\t\treturn idMap[cid]\n\t}\n\n\tcoder, exists := c.Coders[cid]\n\tif !exists {\n\t\tpanic(errors.Errorf(\"attempted to add namespace to missing coder id: %v not in %v\", cid, c.Coders))\n\t}\n\n\t// Updating ComponentCoderIDs of Coder\n\tif coder.GetComponentCoderIds() != nil {\n\t\tvar updatedComponentCoderIDs []string\n\t\tupdatedComponentCoderIDs = append(updatedComponentCoderIDs, coder.ComponentCoderIds...)\n\n\t\tfor i, ccid := range coder.ComponentCoderIds {\n\t\t\tupdatedComponentCoderIDs[i] = addCoderID(c, idMap, ccid, newID)\n\t\t}\n\t\tcoder.ComponentCoderIds = updatedComponentCoderIDs\n\t}\n\n\tidMap[cid] = newID(cid)\n\n\t// Updating Coders map\n\tc.Coders[idMap[cid]] = coder\n\tdelete(c.Coders, cid)","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/xlangx/namespace.go#L14-L50","documentation":"addCoderID in the xlangx namespace package resolves a coder ID in a pipeline's Components map before rewriting its component coder IDs with an expanded namespace prefix. This panic fires when the referenced coder ID is absent from the Components.Coders map, i.e. the pipeline proto has a dangling coder reference. It is an internal invariant violation thrown as a panic, not a returnable error.","triggerScenarios":"Calling xlangx.Expand on a pipeline whose graph.CrossBundles contain a ComponentCoderId pointing at a coder ID that was never added to the pipeline's Components; manually constructing or mutating pipeline protos; a bug in an expansion-response handler that drops coders.","commonSituations":"Cross-language transform expansion where a runner/SDK drops or rewrites components; hand-built pipelines in tests; custom external transform plumbing that constructs ExpandedTransform/pipeline pieces by hand; Beam SDK or runner version mismatches causing ID aliasing.","solutions":["Regenerate the expansion response: re-run the pipeline with matching, current Beam SDK versions for all involved SDKs so coder components are fully populated.","Inspect pipelinejson or the proto (graph.Components.Coders) and confirm every ComponentCoderId referenced by your transform exists.","If building pipelines manually in tests, ensure all component coders are registered in Components before namespace expansion.","File a bug with the Beam project if a stock Expand call triggers this with well-formed expansions."],"exampleFix":"// before: manually built pipeline missing coder registration\npc := pipe.Components\n// coders map not populated -> panic during Expand\n\n// after: derive pipeline from a full pipeline JSON\npipe, _ := pipelinepb.FromJSON(pipelineJSON)\n// ensure expand happens on a complete deserialized pipeline","handlingStrategy":"validation","validationCode":"for _, t := range myTransform.Subtransforms {\n    for _, cid := range t.ComponentCoderIds {\n        if _, ok := pipe.Components.Coders[cid]; !ok {\n            return fmt.Errorf(\"dangling coder id %q before expansion\", cid)\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build pipelines only through the official beam.Pipeline APIs, never by hand-assembling protos.","Keep all involved SDK versions aligned when doing cross-language expansion.","When serializing/deserializing pipeline JSON, round-trip the whole pipeline, not partial components."],"tags":["go","apache-beam","cross-language","panic"],"backgroundTag":"internal-invariant-violation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}