{"record":{"id":"dcbdeb47d4b3386d","repo":"apache/beam","slug":"bad-input-type","errorCode":null,"errorMessage":"bad input type","messagePattern":"bad input type","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/serialize.go","lineNumber":69,"sourceCode":"\t\t}\n\t\tret.Fn = ref\n\t}\n\tif edge.CombineFn != nil {\n\t\tref, err := encodeFn((*graph.Fn)(edge.CombineFn))\n\t\tif err != nil {\n\t\t\twrapped := errors.Wrap(err, \"bad combinefn\")\n\t\t\treturn nil, errors.WithContextf(wrapped, \"encoding userfn %v\", edge)\n\t\t}\n\t\tret.Fn = ref\n\t}\n\tif edge.WindowFn != nil {\n\t\tret.WindowFn = encodeWindowFn(edge.WindowFn)\n\t}\n\n\tfor _, in := range edge.Input {\n\t\tkind, err := encodeInputKind(in.Kind)\n\t\tif err != nil {\n\t\t\twrapped := errors.Wrap(err, \"bad input type\")\n\t\t\treturn nil, errors.WithContextf(wrapped, \"encoding userfn %v\", edge)\n\t\t}\n\t\tt, err := encodeFullType(in.Type)\n\t\tif err != nil {\n\t\t\twrapped := errors.Wrap(err, \"bad input type\")\n\t\t\treturn nil, errors.WithContextf(wrapped, \"encoding userfn %v\", edge)\n\t\t}\n\t\tret.Inbound = append(ret.Inbound, &v1pb.MultiEdge_Inbound{Kind: kind, Type: t})\n\t}\n\tfor _, out := range edge.Output {\n\t\tt, err := encodeFullType(out.Type)\n\t\tif err != nil {\n\t\t\twrapped := errors.Wrap(err, \"bad output type\")\n\t\t\treturn nil, errors.WithContextf(wrapped, \"encoding userfn %v\", edge)\n\t\t}\n\t\tret.Outbound = append(ret.Outbound, &v1pb.MultiEdge_Outbound{Type: t})\n\t}\n\treturn ret, nil","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/serialize.go#L51-L87","documentation":"EncodeMultiEdge wraps encodeInputKind failures as 'bad input type'. encodeInputKind converts the link's graph.InputKind (Main, Iter, CoGBK, Slice, Multi, Union) to its protobuf enum; an input kind with no protobuf mapping cannot be encoded, so graph serialization aborts with context 'encoding userfn'.","triggerScenarios":"EncodeMultiEdge iterating edge.Input where one input's Kind has no corresponding encodeInputKind case — typically a newly added/unknown InputKind or a corrupted graph built with mismatched beam package versions.","commonSituations":"Using a beam version where a new input kind was introduced but the runtime graphx encoder predates it; building MultiEdge structures manually in custom code paths.","solutions":["Read the inner error from encodeInputKind to see the offending kind value","Upgrade the Beam Go SDK so encodeInputKind covers the input kind in use","Rebuild the pipeline graph with matching beam package versions (no stale vendored copies)","If constructing edges manually, use only documented graph.InputKind values"],"exampleFix":"// before\ncustom edge with in.Kind = graph.InputKind(42) // unmapped\n// after\nin.Kind = graph.Main // or upgrade graphx so the kind is encoded","handlingStrategy":"validation","validationCode":"for _, in := range edge.Input {\n  if _, err := encodeInputKind(in.Kind); err != nil {\n    return fmt.Errorf(\"input kind %v unsupported by this graphx version\", in.Kind)\n  }\n}","typeGuard":"func knownInputKind(k graph.InputKind) bool {\n  switch k {\n  case graph.Main, graph.Slice, graph.Iter, graph.CoGBK, graph.Multi, graph.Union:\n    return true\n  }\n  return false\n}","tryCatchPattern":"kind, err := encodeInputKind(in.Kind)\nif err != nil {\n  return fmt.Errorf(\"input kind %v requires a newer Beam SDK: %w\", in.Kind, err)\n}","preventionTips":["Use matching Beam Go SDK versions across all modules","Only use documented graph.InputKind values in custom graph code","Re-vendor Beam dependencies together as one unit","Upgrade the SDK when introducing newer pipeline constructs"],"tags":["go","beam","serialization","input-kind"],"backgroundTag":"invalid-enum-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"}