{"record":{"id":"3e2719028c865ae6","repo":"apache/beam","slug":"bad-element","errorCode":null,"errorMessage":"bad element","messagePattern":"bad element","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/serialize.go","lineNumber":600,"sourceCode":"\tcase v1pb.Type_UINT8:\n\t\treturn reflectx.Uint8, nil\n\tcase v1pb.Type_UINT16:\n\t\treturn reflectx.Uint16, nil\n\tcase v1pb.Type_UINT32:\n\t\treturn reflectx.Uint32, nil\n\tcase v1pb.Type_UINT64:\n\t\treturn reflectx.Uint64, nil\n\tcase v1pb.Type_FLOAT32:\n\t\treturn reflectx.Float32, nil\n\tcase v1pb.Type_FLOAT64:\n\t\treturn reflectx.Float64, nil\n\tcase v1pb.Type_STRING:\n\t\treturn reflectx.String, nil\n\n\tcase v1pb.Type_SLICE:\n\t\telm, err := decodeType(t.GetElement())\n\t\tif err != nil {\n\t\t\twrapped := errors.Wrap(err, \"bad element\")\n\t\t\treturn nil, errors.WithContextf(wrapped, \"failed to decode type %v, bad element\", t)\n\t\t}\n\t\treturn reflect.SliceOf(elm), nil\n\n\tcase v1pb.Type_STRUCT:\n\t\tvar fields []reflect.StructField\n\t\tfor _, f := range t.Fields {\n\t\t\tfType, err := decodeType(f.Type)\n\t\t\tif err != nil {\n\t\t\t\twrapped := errors.Wrap(err, \"bad field type\")\n\t\t\t\treturn nil, errors.WithContextf(wrapped, \"failed to decode type %v, bad field type\", t)\n\t\t\t}\n\n\t\t\tfield := reflect.StructField{\n\t\t\t\tName:      f.GetName(),\n\t\t\t\tPkgPath:   f.GetPkgPath(),\n\t\t\t\tType:      fType,\n\t\t\t\tTag:       reflect.StructTag(f.GetTag()),","sourceCodeStart":582,"sourceCodeEnd":618,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/serialize.go#L582-L618","documentation":"During graph deserialization, decodeType reconstructs reflect.Type values from the protobuf model. For a slice type, the element type is decoded recursively; if that fails the error is wrapped as 'bad element' and contextualized with 'failed to decode type %v, bad element'. This means the slice's element type descriptor in the graph is missing or undecodable.","triggerScenarios":"Decoding a model graph produced by a different Beam version where the element Type message was omitted or written by newer encode logic; corrupted or truncated Element field in v1pb.Type_SLICE.","commonSituations":"Version skew between job-submitter SDK and runner when a runner deserializes the graph; hand-edited or synthetic graph protos; nil Element pointer in the Type message.","solutions":["Ensure the submitting SDK version matches the runner's supported graphx version","Check that the Type_SLICE message has a non-nil Element in the graph proto","Re-encode the pipeline with a current SDK so the element type is present","Inspect the wrapped inner error for the root undecodable type"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"if t.GetKind() == v1pb.Type_SLICE && t.GetElement() == nil {\n\treturn errors.New(\"slice type has no element descriptor\")\n}","tryCatchPattern":"typ, err := graphx.DecodeType(pbType)\nif err != nil {\n\tfor unwrapped := err; unwrapped != nil; {\n\t\tlog.Printf(\"decode failure: %v\", unwrapped)\n\t\tunwrapped = errors.Unwrap(unwrapped)\n\t}\n\treturn fmt.Errorf(\"graph decode failed (version skew?): %w\", err)\n}","preventionTips":["Keep submitter and runner SDK versions aligned","Validate graph protos before decoding (Element must be present)","Handle error chains with errors.Unwrap to find root cause"],"tags":["go","deserialization","apache-beam"],"backgroundTag":"type-mismatch","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"}