{"record":{"id":"f5b97fb5abf71883","repo":"apache/beam","slug":"malformed-transform-v-lacks-a-conforming-pipeline-ptransform","errorCode":null,"errorMessage":"malformed transform; %v lacks a conforming pipeline ptransform","messagePattern":"malformed transform; (.+?) lacks a conforming pipeline ptransform","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/graphx/xlang.go","lineNumber":250,"sourceCode":"\t}\n}\n\n// ExpandedComponents type asserts the Components field with any type\n// and returns its pipeline component proto representation\nfunc ExpandedComponents(exp *graph.ExpandedTransform) (*pipepb.Components, error) {\n\tif c, ok := exp.Components.(*pipepb.Components); ok {\n\t\treturn c, nil\n\t}\n\treturn nil, errors.Errorf(\"malformed components; %v lacks a conforming pipeline component\", exp)\n}\n\n// ExpandedTransform type asserts the Transform field with any type\n// and returns its pipeline ptransform proto representation\nfunc ExpandedTransform(exp *graph.ExpandedTransform) (*pipepb.PTransform, error) {\n\tif t, ok := exp.Transform.(*pipepb.PTransform); ok {\n\t\treturn t, nil\n\t}\n\treturn nil, errors.Errorf(\"malformed transform; %v lacks a conforming pipeline ptransform\", exp)\n}\n\n// ExternalInputs returns the map (tag -> graph node representing the\n// pcollection) of input nodes with respect to the map (tag -> index of Inbound\n// in MultiEdge.Input) of named inputs\nfunc ExternalInputs(e *graph.MultiEdge) map[string]*graph.Node {\n\treturn InboundTagToNode(e.External.InputsMap, e.Input)\n}\n\n// InboundTagToNode relates the tags from inbound links to their respective nodes.\nfunc InboundTagToNode(inputsMap map[string]int, inbound []*graph.Inbound) map[string]*graph.Node {\n\tinputs := make(map[string]*graph.Node)\n\tfor tag, id := range inputsMap {\n\t\tinputs[tag] = inbound[id].From\n\t}\n\treturn inputs\n}\n","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/graphx/xlang.go#L232-L268","documentation":"ExpandedTransform type-asserts an ExpandedTransform's Transform field to *pipepb.PTransform. This error is returned when the stored value is nil or another type, so callers (expandCrossLanguage, mergeExpandedWithPipeline, VerifyNamedOutputs, etc.) cannot read the expanded transform proto.","triggerScenarios":"Calling ExpandedTransform on a graph.ExpandedTransform whose Transform is nil or not a *pipepb.PTransform.","commonSituations":"Manually built or fake ExpandedTransform objects in tests; expansion failures that leave Transform unset; custom code populating Transform with the wrong proto type.","solutions":["Populate ExpandedTransform.Transform with a *pipepb.PTransform from the expansion response.","Check that the expansion call succeeded (error handled) before accessing the expanded transform.","Fix test fixtures to use the correct proto type."],"exampleFix":"// before\nexp := &graph.ExpandedTransform{Components: &pipepb.Components{}}\n// after\nexp := &graph.ExpandedTransform{Transform: &pipepb.PTransform{}, Components: &pipepb.Components{}}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"func hasValidTransform(exp *graph.ExpandedTransform) bool {\n    _, ok := exp.Transform.(*pipepb.PTransform)\n    return ok\n}","tryCatchPattern":"if t, err := graphx.ExpandedTransform(exp); err != nil {\n    return fmt.Errorf(\"expansion lacks transform: %w\", err)\n}","preventionTips":["Check the expansion call's error return before touching ExpandedTransform fields.","Store *pipepb.PTransform in ExpandedTransform.Transform.","Keep fakes/fixtures typed as the real proto types."],"tags":["go","apache-beam","cross-language","type-assertion"],"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"}