{"record":{"id":"60400a5a8766a77d","repo":"apache/beam","slug":"unable-to-generate-proto-representation-of-v","errorCode":null,"errorMessage":"unable to generate proto representation of %v","messagePattern":"unable to generate proto representation of (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/xlangx/expand.go","lineNumber":56,"sourceCode":"\n// maxRetries is the maximum number of retries to attempt connecting to\n// an expansion service endpoint.\nconst maxRetries = 5\n\n// Expand expands an unexpanded graph.ExternalTransform as a\n// graph.ExpandedTransform and assigns it to the ExternalTransform's Expanded\n// field. This requires querying an expansion service based on the configuration\n// details within the ExternalTransform.\n//\n// For framework use only. Users should call beam.CrossLanguage to access foreign transforms\n// rather than calling this function directly.\nfunc Expand(edge *graph.MultiEdge, ext *graph.ExternalTransform) error {\n\t// Build the ExpansionRequest\n\n\t// Obtaining the components and transform proto representing this transform\n\tp, err := graphx.Marshal([]*graph.MultiEdge{edge}, &graphx.Options{})\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"unable to generate proto representation of %v\", ext)\n\t}\n\n\ttransforms := p.GetComponents().GetTransforms()\n\n\t// Transforms consist of only External transform and composites. Composites\n\t// should be removed from proto before submitting expansion request.\n\textTransformID := p.GetRootTransformIds()[0]\n\textTransform := transforms[extTransformID]\n\tfor extTransform.UniqueName != \"External\" {\n\t\tdelete(transforms, extTransformID)\n\t\tp, err = pipelinex.Normalize(p) // Update root transform IDs.\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\ttransforms = p.GetComponents().GetTransforms()\n\t\textTransformID = p.GetRootTransformIds()[0]\n\t\textTransform = transforms[extTransformID]\n\t}","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/xlangx/expand.go#L38-L74","documentation":"Raised in xlangx.Expand when graphx.Marshal fails to serialize the MultiEdge for a cross-language transform into its protobuf (ExpansionRequest) representation. The library wraps the underlying marshal error with the external transform for context. It means the pipeline graph could not be converted to proto before being sent to an expansion service.","triggerScenarios":"Calling beam.CrossLanguage (which reaches TryCrossLanguage -> Expand) with a transform whose graph elements cannot be marshaled by graphx.Marshal, e.g. a MultiEdge containing unsupported input/output types or an unencodable coder.","commonSituations":"Using a cross-language wrapper with custom coders or PCollection types not supported by the Go proto marshaller; pipeline graphs built with constructs the marshaller does not recognize; version skew where graphx cannot represent newer edge features.","solutions":["Inspect the wrapped cause (errors.Wrapf preserves it) to see which component failed to marshal","Check that all PCollections use standard Beam coders supported by the Go SDK proto representation","Upgrade to a recent Beam Go SDK version where graphx supports more transform/coder types","Simplify the transform's inputs/outputs (avoid exotic composite edges) before cross-language expansion"],"exampleFix":"// before\nbeam.CrossLanguage(s, \"pkg:Transform\", cfg, beam.WindowingStrategyDefault, in, customCodedOut) // custom coder unsupported\n// after\nout := beam.CrossLanguage(s, \"pkg:Transform\", cfg, beam.WindowingStrategyDefault, in) // use standard coders on the boundary","handlingStrategy":"try-catch","validationCode":"if edge == nil || ext == nil {\n    return fmt.Errorf(\"cross-language edge/transform not initialized\")\n}","typeGuard":null,"tryCatchPattern":"if err := xlangx.Expand(edge, ext); err != nil {\n    var cause error\n    errors.As(err, &cause) // inspect wrapped marshal cause\n    return fmt.Errorf(\"cross-language expansion setup failed: %w\", err)\n}","preventionTips":["Use standard Beam coders on cross-language transform boundaries","Keep the Go SDK up to date for broader graphx support","Test cross-language transforms in a small pipeline before production"],"tags":["cross-language","protobuf","serialization","go"],"backgroundTag":"protobuf-unmarshal-failed","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"}