{"record":{"id":"7635c3eb82861163","repo":"apache/beam","slug":"res-geterror","errorCode":null,"errorMessage":"res.GetError()","messagePattern":"res\\.GetError\\(\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/xlangx/expand.go","lineNumber":191,"sourceCode":"\t\tretry.Attempts(maxRetries),\n\t\tretry.DelayType(func(n uint, err error, config *retry.Config) time.Duration {\n\t\t\tif n == 0 {\n\t\t\t\treturn time.Second\n\t\t\t}\n\t\t\treturn retry.BackOffDelay(n, err, config)\n\t\t}),\n\t}\n\tvar res *jobpb.ExpansionResponse\n\terr = retry.Do(func() error {\n\t\tres, err = client.Expand(ctx, req)\n\t\treturn err\n\t}, retryOpts...)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"expansion failed\")\n\t\treturn nil, errors.WithContextf(err, \"expanding transform with ExpansionRequest: %v\", req)\n\t}\n\tif len(res.GetError()) != 0 { // ExpansionResponse includes an error.\n\t\terr := errors.New(res.GetError())\n\t\terr = errors.Wrap(err, \"expansion response error\")\n\t\treturn nil, errors.WithContextf(err, \"expanding transform with ExpansionRequest: %v\", req)\n\t}\n\n\treturn res, nil\n}\n\nfunc startAutomatedJavaExpansionService(gradleTarget string, classpath string) (stopFunc func() error, address string, err error) {\n\tjarPath, err := expansionx.GetBeamJar(gradleTarget, core.SdkVersion)\n\tif err != nil {\n\t\treturn nil, \"\", err\n\t}\n\n\tif len(classpath) > 0 {\n\t\tjarPath, err = expansionx.MakeJar(jarPath, classpath)\n\t\tif err != nil {\n\t\t\treturn nil, \"\", err\n\t\t}","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/xlangx/expand.go#L173-L209","documentation":"When querying a cross-language expansion service, the ExpansionResponse may itself carry an error string instead of expanded components. QueryExpansionService wraps that string as an error with 'expansion response error' and expansion request context.","triggerScenarios":"Calling QueryExpansionService (or QueryAutomatedExpansionService / QueryPythonExpansionService) where the remote expansion service processes the ExpansionRequest but responds with res.Error set.","commonSituations":"Python expansion service failing to import the transform's module; Java expansion service URN not registered; version mismatch between the Beam Go SDK and the expansion service; missing external transform dependencies in the service's environment.","solutions":["Read the wrapped expansion-service message; it names the failing URN/module on the service side","Ensure the expansion service version matches the Beam SDK version (mismatched jars/wheels commonly cause this)","For Python expansion, verify the transform module is importable in the service environment and dependencies are installed","Run the expansion service manually with the same address to reproduce and see full service logs","Pass retry/context options if the failure is transient service startup"],"exampleFix":"// diagnose the wrapped cause\nres, err := xlangx.QueryExpansionService(ctx, req)\nif err != nil {\n    var ec xlangx.ExpansionError\n    log.Fatalf(\"expansion failed: %v\", err) // err message contains service-side cause\n}","handlingStrategy":"try-catch","validationCode":"// preflight: verify expansion service is reachable and version-matched\nresp, err := http.Get(expansionServiceAddr + \"/health\") // or grpc ping\nif err != nil { return fmt.Errorf(\"expansion service unreachable at %s\", expansionServiceAddr) }","typeGuard":null,"tryCatchPattern":"res, err := xlangx.QueryExpansionService(ctx, req)\nif err != nil {\n    if strings.Contains(err.Error(), \"expansion response error\") {\n        log.Errorf(\"service-side failure: %v — check service logs for URN %s\", err, req.GetUrn())\n    }\n    return err\n}","preventionTips":["Match expansion service version to the Beam SDK version","Pre-install transform dependencies in the expansion service environment","Test external transforms against a locally started expansion service first","Capture and read the wrapped service error message before escalating"],"tags":["go","apache-beam","cross-language","expansion-service"],"backgroundTag":"upstream-api-error","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}