{"record":{"id":"821c7811aec75a84","repo":"apache/beam","slug":"builddescriptor-failed-to-handle-coder-on-stage-v-for-output","errorCode":null,"errorMessage":"buildDescriptor: failed to handle coder on stage %v for output %+v, pcol %q %v:\n%w %v","messagePattern":"buildDescriptor: failed to handle coder on stage (.+?) for output %\\+v, pcol %q (.+?):\n%w (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/runners/prism/internal/stage.go","lineNumber":552,"sourceCode":"\t\t\tpyld, err := proto.MarshalOptions{}.Marshal(pardo)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unable to encode ParDoPayload for %v in stage %v after rewrite\", tid, stg.ID)\n\t\t\t}\n\t\t\tt.Spec.Payload = pyld\n\t\t}\n\t}\n\tif len(transforms) == 0 {\n\t\treturn fmt.Errorf(\"buildDescriptor: invalid stage - no transforms at all %v\", stg.ID)\n\t}\n\n\t// Start with outputs, since they're simple and uniform.\n\tsink2Col := map[string]string{}\n\tcol2Coders := map[string]engine.PColInfo{}\n\tfor _, o := range stg.outputs {\n\t\tcol := clonePColToBundle(o.Global)\n\t\twOutCid, err := makeWindowedValueCoder(o.Global, comps, coders)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"buildDescriptor: failed to handle coder on stage %v for output %+v, pcol %q %v:\\n%w %v\", stg.ID, o, o.Global, prototext.Format(col), err, stg.transforms)\n\t\t}\n\t\tsinkID := o.Transform + \"_\" + o.Local\n\t\ted := collectionPullDecoder(col.GetCoderId(), coders, comps)\n\n\t\tvar kd func(io.Reader) []byte\n\t\tif kcid, ok := extractKVCoderID(col.GetCoderId(), coders); ok {\n\t\t\tkd = collectionPullDecoder(kcid, coders, comps)\n\t\t}\n\n\t\twinCoder, wDec, wEnc := getWindowValueCoders(comps, col, coders)\n\t\tsink2Col[sinkID] = o.Global\n\t\tcol2Coders[o.Global] = engine.PColInfo{\n\t\t\tGlobalID:    o.Global,\n\t\t\tWindowCoder: winCoder,\n\t\t\tWDec:        wDec,\n\t\t\tWEnc:        wEnc,\n\t\t\tEDec:        ed,\n\t\t\tKeyDec:      kd,","sourceCodeStart":534,"sourceCodeEnd":570,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/prism/internal/stage.go#L534-L570","documentation":"For each stage output, buildDescriptor builds the windowed value coder via makeWindowedValueCoder. Failure here means the output PCollection's coder chain (components, window coders) cannot be resolved or constructed, so elements leaving the stage cannot be encoded for downstream consumers.","triggerScenarios":"makeWindowedValueCoder(o.Global, comps, coders) returns an error for a stage output PCollection — typically an unknown coder ID, malformed component coder list, or unsupported windowing strategy.","commonSituations":"Custom coders registered in the pipeline but not representable by the Go runner; cross-language output collections; pipelines built by SDK versions with coder URNs prism doesn't implement.","solutions":["Read the wrapped error and the listed stage transforms to find the unresolvable coder","Ensure all custom coders are properly registered in the pipeline's components","Upgrade the Beam SDK/runner pair so coder URNs match supported set","Dump pipeline components (prototext) and verify coder IDs referenced by the output PCollection exist"],"exampleFix":"// before: pcol references coder id not in components\npcoll.CoderId = \"customCoderId\"\n// after\npcoll.CoderId = beam.EncodedCoder(p, beam.NewCoder(MyType{})) // registers into components","handlingStrategy":"validation","validationCode":"// Verify output PCollection coder chain resolves\nfor cid := range componentCoderIds(pcoll.GetCoderId(), comps) {\n    if _, ok := comps.GetCoders()[cid]; !ok {\n        return fmt.Errorf(\"output coder %q missing from components\", cid)\n    }\n}","typeGuard":null,"tryCatchPattern":"err := job.Submit(ctx)\nif err != nil && strings.Contains(err.Error(), \"failed to handle coder\") {\n    log.Printf(\"pipeline coder resolution failed: %v\", err)\n    return errFallbackToDirectRunner(p)\n}","preventionTips":["Use standard coders for stage outputs where possible","Register custom coders explicitly","Test cross-language outputs with standard coders first"],"tags":["beam","prism","coder","windowing"],"backgroundTag":"resource-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"}