{"record":{"id":"18cd1ae79c598f82","repo":"apache/beam","slug":"expansion-failed","errorCode":null,"errorMessage":"expansion failed","messagePattern":"expansion failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/xlangx/expand.go","lineNumber":187,"sourceCode":"\tclient := jobpb.NewExpansionServiceClient(conn)\n\n\t// Handling ExpansionResponse\n\tretryOpts := []retry.Option{\n\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 {","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/xlangx/expand.go#L169-L205","documentation":"Raised in xlangx.QueryExpansionService when the retried client.Expand gRPC call to the expansion service ultimately fails. The library wraps the final gRPC error as \"expansion failed\" after exhausting retry attempts. It means the remote expansion service could not successfully process the ExpansionRequest at the transport/RPC level.","triggerScenarios":"QueryPythonExpansionService/QueryAutomatedExpansionService calls where client.Expand returns an error on every retry: service crashed mid-request, connection dropped, RPC deadline exceeded, or service returned a gRPC error status.","commonSituations":"Expansion service OOMs or dies while expanding a large transform; network interruption between pipeline and service; service too slow and retries exhausted; incompatible expansion service version rejecting the request.","solutions":["Check the expansion service logs for the crash or error returned per attempt","Verify service health and connectivity, then re-run the pipeline","Increase/adjust retry options if the service is intermittently overloaded","Align Beam SDK versions between the Go pipeline and the expansion service (e.g. matching Python Beam version)"],"exampleFix":"// before\n// service started ad hoc and dies under load\n// after\n// run expansion service with more memory / stable port and matching Beam version\njava -jar beam-sdks-java-expansion-service-<version>.jar 4444","handlingStrategy":"retry","validationCode":"if err := waitForExpansionService(ctx, addr, 5*time.Second); err != nil {\n    return err // fail fast if service is down before submitting\n}","typeGuard":null,"tryCatchPattern":"res, err := xlangx.QueryExpansionService(ctx, params)\nif err != nil {\n    if isTransient(err) {\n        return retryWithBackoff(ctx, func() error { _, err = xlangx.QueryExpansionService(ctx, params); return err })\n    }\n    return fmt.Errorf(\"expansion RPC failed permanently: %w\", err)\n}","preventionTips":["Run the expansion service with adequate memory and stable infrastructure","Monitor expansion service logs and uptime","Keep SDK and expansion service versions aligned"],"tags":["network","grpc","cross-language","retry"],"backgroundTag":"api-request-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"}