{"record":{"id":"1ab27c421d02ccba","repo":"apache/beam","slug":"bad-input-kind","errorCode":null,"errorMessage":"bad input kind","messagePattern":"bad input kind","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/serialize.go","lineNumber":115,"sourceCode":"\tvar outbound []*graph.Outbound\n\n\topcode := graph.Opcode(edge.Opcode)\n\n\tif edge.Fn != nil {\n\t\tvar err error\n\t\tu, err = decodeFn(edge.Fn)\n\t\tif err != nil {\n\t\t\twrapped := errors.Wrap(err, \"bad function\")\n\t\t\treturn \"\", nil, nil, nil, nil, errors.WithContextf(wrapped, \"decoding userfn %v\", edge)\n\t\t}\n\t}\n\tif edge.WindowFn != nil {\n\t\twfn = decodeWindowFn(edge.WindowFn)\n\t}\n\tfor _, in := range edge.Inbound {\n\t\tkind, err := decodeInputKind(in.Kind)\n\t\tif err != nil {\n\t\t\twrapped := errors.Wrap(err, \"bad input kind\")\n\t\t\treturn \"\", nil, nil, nil, nil, errors.WithContextf(wrapped, \"decoding userfn %v\", edge)\n\t\t}\n\t\tt, err := decodeFullType(in.Type)\n\t\tif err != nil {\n\t\t\twrapped := errors.Wrap(err, \"bad input type\")\n\t\t\treturn \"\", nil, nil, nil, nil, errors.WithContextf(wrapped, \"decoding userfn %v\", edge)\n\t\t}\n\t\tinbound = append(inbound, &graph.Inbound{Kind: kind, Type: t})\n\t}\n\tfor _, out := range edge.Outbound {\n\t\tt, err := decodeFullType(out.Type)\n\t\tif err != nil {\n\t\t\twrapped := errors.Wrap(err, \"bad output type\")\n\t\t\treturn \"\", nil, nil, nil, nil, errors.WithContextf(wrapped, \"decoding userfn %v\", edge)\n\t\t}\n\t\toutbound = append(outbound, &graph.Outbound{Type: t})\n\t}\n","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/serialize.go#L97-L133","documentation":"DecodeMultiEdge reconstructs a MultiEdge from its serialized form, calling decodeInputKind for each inbound edge. When the inbound edge's serialized Kind string cannot be resolved to a known input kind, the error is wrapped as \"bad input kind\" and annotated with the edge being decoded. It indicates the graph model file is corrupt, hand-edited, or produced by an incompatible Beam version.","triggerScenarios":"Calling DecodeMultiEdge (directly or via makeLink/DecodeGraph) on a ModelEdge whose Inbound[i].Kind contains an unrecognized kind string — e.g. a model file serialized with a newer Beam version that added a new input kind, or a manually modified/corrupted model JSON/protobuf.","commonSituations":"Deserializing a pipeline model file generated by a different Beam SDK version; hand-editing model files; truncation or corruption of the serialized graph during storage/transfer.","solutions":["Use the same (or compatible) Beam version to encode and decode the graph model","Regenerate the model file from the original pipeline rather than editing it by hand","Check model file integrity (not truncated/corrupted)","Inspect edge.Inbound[].Kind values against graphx's valid kind strings to find the offender"],"exampleFix":"// before: decoding a model produced by a newer Beam\nmodel, _ := ioutil.ReadFile(\"model.json\")\ngraphx.DecodeMultiEdge(model)\n// after: align SDK versions with the producer of the model\n// (no code change — pin sdks/go version to match the writer, then re-run)","handlingStrategy":"try-catch","validationCode":"for _, in := range edge.Inbound {\n\tif _, err := graphx.DecodeInputKind(in.Kind); err != nil {\n\t\treturn fmt.Errorf(\"unrecognized inbound kind %q\", in.Kind)\n\t}\n}","typeGuard":null,"tryCatchPattern":"edge, err := graphx.DecodeMultiEdge(data)\nif err != nil {\n\tif strings.Contains(err.Error(), \"bad input kind\") {\n\t\treturn fmt.Errorf(\"model file incompatible or corrupted: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Pin identical Beam versions for graph encode and decode","Never hand-edit serialized model files","Validate model files after transport (checksum)","Keep a registry test that round-trips all your graphs"],"tags":["go","beam","serialization","graphx"],"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-14T16:17:12.679Z"}