{"record":{"id":"cf38be4c7797bc92","repo":"apache/beam","slug":"kv-coder-with-more-than-2-components-s","errorCode":null,"errorMessage":"KV coder with more than 2 components: %s","messagePattern":"KV coder with more than 2 components: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"sdks/go/pkg/beam/runners/prism/internal/coders.go","lineNumber":351,"sourceCode":"\t\treturn func(r io.Reader) {\n\t\t\tcoder.DecodeDouble(r)\n\t\t}\n\tcase urns.CoderIterable:\n\t\tccids := c.GetComponentCoderIds()\n\t\tif len(ccids) != 1 {\n\t\t\tpanic(fmt.Sprintf(\"Iterable coder must have only one component: %s\", prototext.Format(c)))\n\t\t}\n\t\ted := pullDecoderNoAlloc(coders[ccids[0]], coders)\n\t\treturn func(r io.Reader) {\n\t\t\tl, _ := coder.DecodeInt32(r)\n\t\t\tfor i := int32(0); i < l; i++ {\n\t\t\t\ted(r)\n\t\t\t}\n\t\t}\n\tcase urns.CoderKV:\n\t\tccids := c.GetComponentCoderIds()\n\t\tif len(ccids) != 2 {\n\t\t\tpanic(fmt.Sprintf(\"KV coder with more than 2 components: %s\", prototext.Format(c)))\n\t\t}\n\t\tkd := pullDecoderNoAlloc(coders[ccids[0]], coders)\n\t\tvd := pullDecoderNoAlloc(coders[ccids[1]], coders)\n\t\treturn func(r io.Reader) {\n\t\t\tkd(r)\n\t\t\tvd(r)\n\t\t}\n\tcase urns.CoderWindowedValue:\n\t\tccids := c.GetComponentCoderIds()\n\t\tif len(ccids) != 2 {\n\t\t\tpanic(fmt.Sprintf(\"WindowedValue coder with more than 2 components: %s\", prototext.Format(c)))\n\t\t}\n\t\ted := pullDecoderNoAlloc(coders[ccids[0]], coders)\n\t\twd := pullDecoderNoAlloc(coders[ccids[1]], coders)\n\t\treturn func(r io.Reader) {\n\t\t\ted(r)\n\t\t\twd(r)\n\t\t}","sourceCodeStart":333,"sourceCodeEnd":369,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/prism/internal/coders.go#L333-L369","documentation":"The prism runner builds pull-based decoders for pipeline coders. A KV coder must have exactly two component coders (key and value); this panic fires when the pipeline harness hands prism a KV coder whose component list has any other length, meaning the coder graph sent by the SDK is malformed.","triggerScenarios":"pullDecoderNoAlloc encounters a proto coder with urn beam:coders:kv:v1 whose GetComponentCoderIds() returns != 2, e.g. a KV coder referencing zero, one, or three+ component coder IDs, typically due to a corrupted or hand-edited pipeline proto or an SDK-side coder-construction bug.","commonSituations":"Running pipelines cross-language where one SDK emits a malformed KV coder; SDK/runner version skew where coder representation changed; custom DoFns or coders that assemble KV coders programmatically with the wrong number of components.","solutions":["Inspect the coder proto in the panic message (prototext format) and check the component_coder_ids count","Verify SDK and prism runner versions match (use the same Beam release on both sides)","Reproduce with a minimal pipeline to identify the transform producing the bad coder","File/inspect a Beam issue if the SDK legitimately emitted a malformed KV coder"],"exampleFix":"// before: constructing a KV coder manually with wrong components\ncoder := pipepb.Coder{Spec: ...} // components omitted\n// after: ensure exactly 2 component coder IDs are set\nif len(kvCoder.GetComponentCoderIds()) != 2 { /* fix coder construction */ }","handlingStrategy":"validation","validationCode":"if len(kvCoder.GetComponentCoderIds()) != 2 { return fmt.Errorf(\"KV coder must have exactly 2 components, got %d\", len(kvCoder.GetComponentCoderIds())) }","typeGuard":null,"tryCatchPattern":"// panics are not recoverable at this layer; recover only at the harness boundary\ndefer func() { if r := recover(); r != nil { log.Errorf(\"coder setup panicked: %v\", r) } }()","preventionTips":["Use stock Beam SDK coder constructors instead of hand-building coder protos","Keep SDK and prism runner versions identical","Validate coder protos in custom tooling before submitting pipelines"],"tags":["go","beam","prism","coder","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"}