{"record":{"id":"914d5ef7558f0d06","repo":"apache/beam","slug":"builddescriptor-couldn-t-rewrite-coder-q-for-primary-input","errorCode":null,"errorMessage":"buildDescriptor: couldn't rewrite coder %q for primary input pcollection %q: %w","messagePattern":"buildDescriptor: couldn't rewrite coder %q for primary input pcollection %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/runners/prism/internal/stage.go","lineNumber":615,"sourceCode":"\t\t}\n\t\tprepSide, err := handleSideInput(si, comps, transforms, pcollections, coders, em)\n\t\tif err != nil {\n\t\t\tslog.Error(\"buildDescriptor: handleSideInputs\", \"error\", err, slog.String(\"transformID\", si.Transform))\n\t\t\treturn err\n\t\t}\n\t\tprepareSides = append(prepareSides, prepSide)\n\t}\n\n\t// Finally, the parallel input, which is it's own special snowflake, that needs a datasource.\n\t// This id is directly used for the source, but this also copies\n\t// coders used by side inputs to the coders map for the bundle, so\n\t// needs to be run for every ID.\n\n\tcol := clonePColToBundle(stg.primaryInput)\n\tif newCID, err := lpUnknownCoders(col.GetCoderId(), coders, comps.GetCoders()); err == nil && col.GetCoderId() != newCID {\n\t\tcol.CoderId = newCID\n\t} else if err != nil {\n\t\treturn fmt.Errorf(\"buildDescriptor: couldn't rewrite coder %q for primary input pcollection %q: %w\", col.GetCoderId(), stg.primaryInput, err)\n\t}\n\n\twInCid, err := makeWindowedValueCoder(stg.primaryInput, comps, coders)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"buildDescriptor: failed to handle coder on stage %v for primary input, pcol %q %v:\\n%w\\n%v\", stg.ID, stg.primaryInput, prototext.Format(col), err, stg.transforms)\n\t}\n\ted := collectionPullDecoder(col.GetCoderId(), coders, comps)\n\twinCoder, wDec, wEnc := getWindowValueCoders(comps, col, coders)\n\n\tvar kd func(io.Reader) []byte\n\tif kcid, ok := extractKVCoderID(col.GetCoderId(), coders); ok {\n\t\tkd = collectionPullDecoder(kcid, coders, comps)\n\t}\n\n\tinputInfo := engine.PColInfo{\n\t\tGlobalID:    stg.primaryInput,\n\t\tWindowCoder: winCoder,\n\t\tWDec:        wDec,","sourceCodeStart":597,"sourceCodeEnd":633,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/prism/internal/stage.go#L597-L633","documentation":"The stage's primary input PCollection coder is rewritten (LP'd) to concrete coders before building the bundle descriptor. If lpUnknownCoders fails, prism cannot encode/decode the stage's main input and returns this error naming the original coder ID and PCollection.","triggerScenarios":"lpUnknownCoders(col.GetCoderId(), coders, comps.GetCoders()) returns an error for stg.primaryInput during buildDescriptor.","commonSituations":"Primary inputs produced by external transforms or cross-language expansion with unknown coders; pipelines with unregistered custom coder URNs; SDK/runner version skew.","solutions":["Inspect the wrapped error to identify the failing coder URN or component","Ensure the input PCollection's coder is fully specified in pipeline components","Regenerate the pipeline with a compatible SDK version","Avoid hand-editing pipeline protos; use the SDK's coder registration APIs"],"exampleFix":"// before: hand-built proto references coder \"unknown1\" absent from components\n// after: register the coder in the pipeline graph\nbeam.RegisterCoder(reflect.TypeOf(MyType{}), enc, dec)","handlingStrategy":"validation","validationCode":"if _, ok := comps.GetCoders()[inputPcol.GetCoderId()]; !ok {\n    return fmt.Errorf(\"primary input coder %q not in components\", inputPcol.GetCoderId())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Register coders for all main-input types","Avoid hand-crafted pipeline protos","Keep SDK versions consistent across the pipeline"],"tags":["beam","prism","coder","input"],"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"}