{"record":{"id":"939f4cb256999a5e","repo":"apache/beam","slug":"could-not-unmarshal-iterable-coder-from-v-expected-one","errorCode":null,"errorMessage":"could not unmarshal iterable coder from %v, expected one component but got %d","messagePattern":"could not unmarshal iterable coder from (.+?), expected one component but got (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/coder.go","lineNumber":344,"sourceCode":"\tcase \"\":\n\t\t// TODO(herohde) 11/27/2017: we still see CoderRefs from Dataflow. Handle that\n\t\t// case here, for now, so that the harness can use this logic.\n\n\t\tpayload := c.GetSpec().GetPayload()\n\n\t\tvar ref CoderRef\n\t\tif err := json.Unmarshal(payload, &ref); err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"could not unmarshal CoderRef from %v, failed to decode urn-less coder's payload \\\"%v\\\"\", c, string(payload))\n\t\t}\n\t\tc, err := DecodeCoderRef(&ref)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"could not unmarshal CoderRef from %v, failed to decode CoderRef \\\"%v\\\"\", c, string(payload))\n\t\t}\n\t\treturn c, nil\n\n\tcase urnIterableCoder, urnStateBackedIterableCoder:\n\t\tif len(components) != 1 {\n\t\t\treturn nil, errors.Errorf(\"could not unmarshal iterable coder from %v, expected one component but got %d\", c, len(components))\n\t\t}\n\t\telm, err := b.Coder(components[0])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn coder.NewI(elm), nil\n\tcase urnTimerCoder:\n\t\tif len(components) != 2 {\n\t\t\treturn nil, errors.Errorf(\"could not unmarshal timer coder from %v, expected two component but got %d\", c, len(components))\n\t\t}\n\t\telm, err := b.Coder(components[0])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tw, err := b.WindowCoder(components[1])\n\t\tif err != nil {\n\t\t\treturn nil, errors.Errorf(\"could not unmarshal window coder for timer: %w\", err)\n\t\t}","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/coder.go#L326-L362","documentation":"Iterable coders (beam:coder:iterable:v1 and the state-backed variant) must have exactly one component coder describing the element type. makeCoder found a different component count, so it cannot build coder.NewI.","triggerScenarios":"Decoding an iterable coder whose components list has 0 or 2+ entries — typically a malformed or foreign-encoded pipeline graph.","commonSituations":"Hand-edited pipeline JSON; graphs produced by other SDKs with different arity conventions; corrupted job submission artifacts.","solutions":["Inspect the coder's components list and ensure exactly one element coder is nested","Regenerate the pipeline graph with the Go SDK","Fix hand-written CoderRef JSON to nest one component under the iterable coder","Align SDK versions if a foreign runner produced the coder"],"exampleFix":"// before: iterable coder with no components\n// after: {\"urn\":\"beam:coder:iterable:v1\",\"components\":[{\"urn\":\"beam:coder:varint:v1\",\"components\":[]}]}","handlingStrategy":"validation","validationCode":"if ref.Urn == \"beam:coder:iterable:v1\" && len(ref.Components) != 1 {\n    return fmt.Errorf(\"iterable coder must have exactly 1 component, got %d\", len(ref.Components))\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-assemble coder component lists","Regenerate graphs with the Go SDK after version upgrades","Add round-trip tests for pipeline coders"],"tags":["go","apache-beam","coder","validation"],"backgroundTag":"missing-required-argument","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"}