{"record":{"id":"08ffe027a1440982","repo":"apache/beam","slug":"failed-to-add-output-coder-to-coder-registry-v","errorCode":null,"errorMessage":"failed to add output coder to coder registry: %v","messagePattern":"failed to add output coder to coder registry: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/translate.go","lineNumber":774,"sourceCode":"\t\tPayload: edge.External.Payload,\n\t}\n\n\ttransform := &pipepb.PTransform{\n\t\tUniqueName:    namedEdge.Name,\n\t\tSpec:          spec,\n\t\tInputs:        inputs,\n\t\tEnvironmentId: m.addDefaultEnv(),\n\t}\n\n\t// Add the coders for output in the marshaller even if expanded is nil\n\t// for output coder field in expansion request.\n\t// We need this specifically for Python External Transforms.\n\tnames := strings.Split(spec.Urn, \":\")\n\tif len(names) > 2 && names[2] == \"python\" {\n\t\tfor _, out := range edge.Output {\n\t\t\tid, err := m.coders.Add(out.To.Coder)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", errors.Wrapf(err, \"failed to add output coder to coder registry: %v\", m.coders)\n\t\t\t}\n\t\t\tout.To.Coder.ID = id\n\t\t}\n\t}\n\n\tif edge.External.Expanded != nil {\n\t\t// Outputs need to temporarily match format of unnamed Go SDK Nodes.\n\t\t// After the initial pipeline is constructed, these will be used to correctly\n\t\t// map consumers of these outputs to the expanded transform's outputs.\n\t\toutputs := make(map[string]string)\n\t\tfor i, out := range edge.Output {\n\t\t\tif _, err := m.addNode(out.To); err != nil {\n\t\t\t\treturn \"\", errors.Wrapf(err, \"failed to expand cross language transform for edge: %v\", namedEdge)\n\t\t\t}\n\t\t\toutputs[fmt.Sprintf(\"i%v\", i)] = nodeID(out.To)\n\t\t}\n\t\ttransform.Outputs = outputs\n\t\tenvironment, err := ExpandedTransform(edge.External.Expanded)","sourceCodeStart":756,"sourceCodeEnd":792,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/translate.go#L756-L792","documentation":"Specifically for Python-origin ExternalTransforms (URN of the form beam:transform:...:python), expandCrossLanguage registers each output PCollection's coder in the coder registry. If m.coders.Add fails (coder cannot be serialized/registered), the error is wrapped as 'failed to add output coder to coder registry'. The coder registry ran out of IDs or rejected the coder payload.","triggerScenarios":"An ExternalTransform with a python URN whose output coder cannot be added to the marshaller's coder registry — e.g. a coder whose payload marshalling fails or an unsupported custom coder crossing the language boundary.","commonSituations":"Python cross-language transforms producing PCollections with custom coders the Go side cannot represent; version drift between the Python transform's coder payload and the Go SDK's coder support.","solutions":["Inspect the wrapped error to see which coder failed to register","Ensure output coders are standard/serializable (e.g. use coders the Go SDK supports across languages)","Check URN format: this path only triggers when names[2]==\"python\"; a malformed URN could route to the wrong branch","Upgrade the Go SDK so newer coder payload formats are understood"],"exampleFix":"null","handlingStrategy":"validation","validationCode":"// ensure output coders are standard types before external transform\nfor _, out := range outputs {\n    if !isStandardCoder(out.Coder) {\n        return fmt.Errorf(\"output coder %T not cross-language safe\", out.Coder)\n    }\n}","typeGuard":null,"tryCatchPattern":"err := beam.Run(ctx, pr)\nif err != nil && strings.Contains(err.Error(), \"failed to add output coder to coder registry\") {\n    log.Printf(\"output coder not registerable: %v\", err)\n    return fmt.Errorf(\"use standard output coders for python external transforms: %w\", err)\n}","preventionTips":["Use primitive/standard coders (string, bytes, proto, JSON) on python external transform outputs","Avoid custom Go coders on cross-language boundaries","Match URN conventions exactly (beam:transform:x:python:v1)"],"tags":["go","apache-beam","cross-language","coder-registry"],"backgroundTag":"coder-registration-failed","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"}