{"record":{"id":"605307dc21835f8a","repo":"apache/beam","slug":"bad-i-v","errorCode":null,"errorMessage":"bad I: %v","messagePattern":"bad I: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/dataflow.go","lineNumber":135,"sourceCode":"\t\tvalue, err := EncodeCoderRef(c.Components[1])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &CoderRef{Type: pairType, Components: []*CoderRef{key, value}, IsPairLike: true}, nil\n\n\tcase coder.Nullable:\n\t\tif len(c.Components) != 1 {\n\t\t\treturn nil, errors.Errorf(\"bad N: %v\", c)\n\t\t}\n\t\tinnerref, err := EncodeCoderRef(c.Components[0])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &CoderRef{Type: nullableType, Components: []*CoderRef{innerref}}, nil\n\n\tcase coder.Iterable:\n\t\tif len(c.Components) != 1 {\n\t\t\treturn nil, errors.Errorf(\"bad I: %v\", c)\n\t\t}\n\t\tinnerref, err := EncodeCoderRef(c.Components[0])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &CoderRef{Type: streamType, Components: []*CoderRef{innerref}}, nil\n\n\tcase coder.CoGBK:\n\t\tif len(c.Components) < 2 {\n\t\t\treturn nil, errors.Errorf(\"bad CoGBK: %v\", c)\n\t\t}\n\n\t\trefs, err := EncodeCoderRefs(c.Components)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvalue := refs[1]","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/dataflow.go#L117-L153","documentation":"EncodeCoderRef serializes a coder into the runner (Dataflow) representation. A coder.Iterable must wrap exactly one component coder (the element coder); any other component count is structurally invalid, so encoding aborts with this error naming the coder. This prevents emitting a stream CoderRef the service cannot interpret.","triggerScenarios":"Encoding a coder.Coder with Kind coder.Iterable whose Components slice is empty or has more than one entry — typically via EncodeCoder/EncodeCoderRefs during pipeline submission to Dataflow.","commonSituations":"Manually constructed iterable coders with no element component; a GBK/PCollection transform whose output coder was overwritten with a wrong shape; version skew between the pipeline-graph serializer and a custom coder factory.","solutions":["Ensure the Iterable coder has exactly one component: len(c.Components) == 1.","Create iterable coders through the SDK (e.g. coder.NewI, or coders inferred from typex.Stream types) rather than by hand.","Inspect the PCollection whose coder triggers this and fix the custom coder override.","Align SDK versions if the coder was produced by decode of an older/newer pipeline artifact."],"exampleFix":"// before\nc := &coder.Coder{Kind: coder.Iterable, T: t, Components: nil}\nref, err := graphx.EncodeCoderRef(c)\n\n// after\nelem := graphx.InferCoder(typex.New(typex.StringType))\nc := &coder.Coder{Kind: coder.Iterable, T: typex.New(typex.StreamType, elem.T), Components: []*coder.Coder{elem}}\nref, err := graphx.EncodeCoderRef(c)","handlingStrategy":"validation","validationCode":"func validIterable(c *coder.Coder) bool {\n\treturn c != nil && c.Kind == coder.Iterable && len(c.Components) == 1\n}","typeGuard":"func hasComponents(c *coder.Coder, n int) bool { return c != nil && len(c.Components) == n }","tryCatchPattern":"ref, err := graphx.EncodeCoderRef(c)\nif err != nil {\n\tif strings.Contains(err.Error(), \"bad I\") {\n\t\treturn fmt.Errorf(\"iterable coder must have exactly 1 element component: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Use coder.NewI / type-inferred coders instead of hand-built structs","Add a pre-submission validation pass over all PCollection coders","Don't overwrite coders of intermediate PCollections in custom transforms"],"tags":["go","beam","coder-serialization","dataflow"],"backgroundTag":"invalid-argument-value","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"}