{"record":{"id":"9983e39a114b01cb","repo":"apache/beam","slug":"expansion-response-error","errorCode":null,"errorMessage":"expansion response error","messagePattern":"expansion response error","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/xlangx/expand.go","lineNumber":192,"sourceCode":"\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}\n\t}","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/xlangx/expand.go#L174-L210","documentation":"Raised in xlangx.QueryExpansionService when the expansion service responds successfully at the gRPC level but its ExpansionResponse carries a non-empty Error string. The remote service itself reported a problem expanding the transform; the library wraps that message as \"expansion response error\". The underlying text names the actual remote failure.","triggerScenarios":"Any QueryPythonExpansionService/QueryAutomatedExpansionService call where the remote expansion service rejects the ExpansionRequest: missing transform URN on the service side, incompatible payload, construction failure of the remote transform.","commonSituations":"Requesting a Java/Python transform that does not exist in the expansion service's classpath/installed packages; constructor or validation errors in the remote transform; version mismatch between SDK and the expansion service artifacts.","solutions":["Read the wrapped res.GetError() text — it states the remote cause","Verify the requested transform URN exists in the expansion service's environment (installed package/JAR)","Ensure expansion service artifacts (JAR/Beam package) match the pipeline's Beam version","Fix remote-side configuration (classpath, dependencies, transform payload) reported by the service"],"exampleFix":"// before\nbeam.CrossLanguage(s, \"my.org:missing:transform:v1\", cfg, nil, in) // URN not in service\n// after\nbeam.CrossLanguage(s, \"my.org:existing:transform:v1\", cfg, nil, in)","handlingStrategy":"try-catch","validationCode":"// check the transform URN is implemented by the service before expansion\nif !serviceSupportsURN(urn) {\n    return fmt.Errorf(\"transform %q not available in expansion service\", urn)\n}","typeGuard":null,"tryCatchPattern":"res, err := xlangx.QueryExpansionService(ctx, params)\nif err != nil {\n    // the remote cause is embedded; surface it to the user\n    return fmt.Errorf(\"expansion rejected by service: %w\", err)\n}","preventionTips":["Confirm the transform URN exists in the expansion service's installed packages/JARs","Match expansion service artifact versions with the pipeline SDK version","Log the full error chain — res.GetError() names the remote failure"],"tags":["cross-language","grpc","remote-error","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-14T16:17:12.679Z"}