{"record":{"id":"ce829819d2000fba","repo":"apache/beam","slug":"tried-cross-language-for-v-against-v-and-failed","errorCode":null,"errorMessage":"tried cross-language for %v against %v and failed","messagePattern":"tried cross-language for (.+?) against (.+?) and failed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"sdks/go/pkg/beam/xlang.go","lineNumber":165,"sourceCode":"// CrossLanguage call.\n//\n// In addition, urns can be bound to specific expansion addresses, using\n// xlangx.RegisterOverrideForUrn. This allows for testing specific overrides, or other\n// custom implementations to be used instead.\n//\n// To ignore overrides regardless of URN, wrapping the expansion address in\n// a call to xlangx.Require, will force expansion using the given address.\nfunc CrossLanguage(\n\ts Scope,\n\turn string,\n\tpayload []byte,\n\texpansionAddr string,\n\tnamedInputs map[string]PCollection,\n\tnamedOutputTypes map[string]FullType,\n) map[string]PCollection {\n\tnamedOutputs, err := TryCrossLanguage(s, urn, payload, expansionAddr, namedInputs, namedOutputTypes)\n\tif err != nil {\n\t\tpanic(errors.WithContextf(err, \"tried cross-language for %v against %v and failed\", urn, expansionAddr))\n\t}\n\treturn namedOutputs\n}\n\n// TryCrossLanguage coordinates the core functions required to execute the cross-language transform.\n// See CrossLanguage for user documentation.\nfunc TryCrossLanguage(\n\ts Scope,\n\turn string,\n\tpayload []byte,\n\texpansionAddr string,\n\tnamedInputs map[string]PCollection,\n\tnamedOutputTypes map[string]FullType,\n) (map[string]PCollection, error) {\n\tif !s.IsValid() {\n\t\tpanic(errors.New(\"invalid scope\"))\n\t}\n","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/xlang.go#L147-L183","documentation":"beam.CrossLanguage submits a cross-language transform to an expansion service and, unlike TryCrossLanguage, treats any expansion failure as fatal by panicking with context about the URN and expansion address. The panic wraps the underlying error (typically from the expansion service request) via errors.WithContextf, so the root cause is preserved in the message.","triggerScenarios":"Calling beam.CrossLanguage (directly or via Prefix, CoGroupByKey, CombinePerKey, CombineGlobally, Flatten, GroupByKey helpers) where TryCrossLanguage returns an error: expansion service unreachable at expansionAddr, unknown transform URN, malformed payload, or the external transform failing schema validation on the service side.","commonSituations":"Wrong or stale expansion service address/port; expansion service container not started (e.g. Kafka/SQL expansion service); URN or payload mismatch after upgrading the external transform's jar/module; network/firewall blocking the expansion endpoint.","solutions":["Read the wrapped cause in the panic message — it names the actual expansion failure (connection refused, unknown URN, etc.).","Verify the expansion service is running and expansionAddr (host:port) is correct and reachable.","Switch to beam.TryCrossLanguage to handle the error gracefully and return it to callers.","Confirm the transform URN and payload match the version of the expansion service you are connecting to.","Check network/namespace connectivity (e.g. k8s service DNS, Docker port mapping) between the pipeline and the service."],"exampleFix":"// before\nbeam.CrossLanguage(s, urn, payload, \"localhost:32768\", inputs, outputs) // panics on any expansion error\n// after\nouts, err := beam.TryCrossLanguage(s, urn, payload, \"localhost:32768\", inputs, outputs)\nif err != nil {\n    return fmt.Errorf(\"expanding %s via localhost:32768: %w\", urn, err)\n}","handlingStrategy":"fallback","validationCode":"// verify the expansion service before building the pipeline\nconn, err := net.DialTimeout(\"tcp\", expansionAddr, 5*time.Second)\nif err != nil {\n    return fmt.Errorf(\"expansion service %s unreachable: %w\", expansionAddr, err)\n}\nconn.Close()","typeGuard":null,"tryCatchPattern":"// prefer TryCrossLanguage over the panicking CrossLanguage:\nouts, err := beam.TryCrossLanguage(s, urn, payload, expansionAddr, inputs, outputs)\nif err != nil {\n    return fmt.Errorf(\"cross-language %s via %s failed: %w\", urn, expansionAddr, err)\n}","preventionTips":["Start and health-check the expansion service before submitting pipelines.","Keep expansion service and SDK versions compatible with the transform URN/payload.","Prefer beam.TryCrossLanguage in library code; reserve CrossLanguage for scripts where failing fast is fine.","Verify network reachability (host:port, DNS, firewall) for the expansion address."],"tags":["go","apache-beam","cross-language","expansion-service"],"backgroundTag":"http-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"}