{"record":{"id":"b566b38a7ffc000c","repo":"apache/beam","slug":"cannot-register-component-s","errorCode":null,"errorMessage":"cannot register component: %s","messagePattern":"cannot register component: (.+?)","errorType":"exception","errorClass":"java.lang.RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/External.java","lineNumber":251,"sourceCode":"        if (entry.getValue() instanceof PCollection<?>) {\n          try {\n            String id = components.registerPCollection((PCollection) entry.getValue());\n            externalPCollectionIdMapBuilder.put((PCollection) entry.getValue(), id);\n            ptransformBuilder.putInputs(entry.getKey().getId(), id);\n            AppliedPTransform<?, ?, ?> fakeImpulse =\n                AppliedPTransform.of(\n                    String.format(\"%s_%s\", IMPULSE_PREFIX, entry.getKey().getId()),\n                    PValues.expandInput(PBegin.in(p)),\n                    ImmutableMap.of(entry.getKey(), (PCollection<?>) entry.getValue()),\n                    Impulse.create(),\n                    // TODO(https://github.com/apache/beam/issues/18371): Add proper support for\n                    // Resource Hints with XLang.\n                    ResourceHints.create(),\n                    p);\n            // using fake Impulses to provide inputs\n            components.registerPTransform(fakeImpulse, Collections.emptyList());\n          } catch (IOException e) {\n            throw new RuntimeException(\n                String.format(\"cannot register component: %s\", e.getMessage()));\n          }\n        }\n      }\n\n      ExpansionApi.ExpansionRequest.Builder requestBuilder =\n          ExpansionApi.ExpansionRequest.newBuilder();\n      requestBuilder.putAllOutputCoderRequests(\n          outputCoders.entrySet().stream()\n              .collect(\n                  Collectors.toMap(\n                      Map.Entry::getKey,\n                      kv -> {\n                        try {\n                          return components.registerCoder(kv.getValue());\n                        } catch (IOException e) {\n                          throw new RuntimeException(e);\n                        }","sourceCodeStart":233,"sourceCodeEnd":269,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/External.java#L233-L269","documentation":"In External.expand (cross-language pipeline expansion), components such as fake Impulse PTransforms are registered into the components builder before sending the expansion request. If registering a component throws IOException, it is wrapped as RuntimeException 'cannot register component: <message>'. It indicates a failure serializing/adding a component to the expansion request's components map.","triggerScenarios":"Calling External.of(...).expand(...) where building/registering the fake impulse or input components fails — e.g. an underlying IOException from coder/transform registration in the components builder.","commonSituations":"Cross-language transforms (Python/Scala via expansion service) with inputs that fail component registration; I/O errors while writing proto components; malformed transform payloads in the expansion request path.","solutions":["Check the wrapped cause message (it is appended to the RuntimeException message) to find the underlying IOException","Verify the external transform's inputs/coders are well-formed before expansion","Ensure the expansion service and SDK versions are compatible and the service is reachable/restart it"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { external.expand(pipeline.apply(Create.of(...))); } catch (RuntimeException e) { if (e.getMessage().startsWith(\"cannot register component:\")) { log.error(\"expansion component registration failed\", e); /* inspect cause and expansion service */ } }","preventionTips":["Keep the expansion service version-compatible with the SDK","Validate external transform inputs before expand","Check expansion service logs alongside the wrapped message"],"tags":["java","apache-beam","cross-language","expansion"],"backgroundTag":"internal-invariant-violation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}