{"record":{"id":"21a26c6d6a4f1a8e","repo":"apache/beam","slug":"could-not-unmarshal-length-prefix-coder-component-w","errorCode":null,"errorMessage":"could not unmarshal length prefix coder component: %w","messagePattern":"could not unmarshal length prefix coder component: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/coder.go","lineNumber":266,"sourceCode":"\t\t\t// a CoGBK is done at the DataSource, since that's when we can check against the downstream nodes.\n\t\t}\n\n\t\tvalue, err := b.Coder(id)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tt := typex.New(typex.KVType, key.T, value.T)\n\t\treturn &coder.Coder{Kind: coder.KV, T: t, Components: []*coder.Coder{key, value}}, nil\n\n\tcase urnLengthPrefixCoder:\n\t\tif len(components) != 1 {\n\t\t\treturn nil, errors.Errorf(\"could not unmarshal length prefix coder from %v, want a single sub component but have %d\", c, len(components))\n\t\t}\n\n\t\tsub, err := b.peek(components[0])\n\t\tif err != nil {\n\t\t\treturn nil, errors.Errorf(\"could not unmarshal length prefix coder component: %w\", err)\n\t\t}\n\n\t\t// No payload means this coder was length prefixed by the runner\n\t\t// but is likely self describing - AKA a beam coder.\n\t\t// if len(sub.GetSpec().GetPayload()) == 0 {\n\t\t// \treturn b.makeCoder(components[0], sub)\n\t\t// }\n\t\t// TODO(lostluck) 2018/10/17: Make this strict again, once dataflow can use\n\t\t// the portable pipeline model directly (BEAM-2885)\n\t\tswitch u := sub.GetSpec().GetUrn(); u {\n\t\tcase \"\", urnCustomCoder:\n\t\t\tvar ref v1pb.CustomCoder\n\t\t\tif err := protox.DecodeBase64(string(sub.GetSpec().GetPayload()), &ref); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tcustom, err := decodeCustomCoder(&ref)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/coder.go#L248-L284","documentation":"After validating arity, makeCoder peeks the single sub-component of a length-prefix coder to determine the wrapped coder. If that peek fails, the error is wrapped as \"could not unmarshal length prefix coder component: %w\".","triggerScenarios":"makeCoder on a length-prefix coder whose component ID resolves to a coder proto that cannot be unmarshaled (missing definition, bad URN/payload).","commonSituations":"Runner-side length-prefixed coders referencing coders not shipped in the pipeline proto; cross-version payload format changes; corrupted serialized pipelines.","solutions":["Follow the wrapped cause to the actual failing nested coder.","Ensure the referenced component coder is present in the pipeline's coders map.","Align SDK versions between producer and consumer of the pipeline proto.","If the runner added length-prefixing, verify the self-describing payload is valid."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"cd, err := um.Coder(id)\nif err != nil && strings.Contains(err.Error(), \"length prefix coder component\") {\n    log.Printf(\"resolve wrapped nested coder failure: %v\", err)\n}","preventionTips":["Ensure the sub-component coder referenced by length-prefix coders is defined.","Round-trip test serialized pipelines in CI.","Avoid mixing Beam SDK versions that changed length-prefix payloads."],"tags":["go","coder","length-prefix","unmarshaling"],"backgroundTag":"protobuf-unmarshal-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"}