{"record":{"id":"aef3565ae7d4ae2d","repo":"apache/beam","slug":"cannot-rehydrate-pcollection","errorCode":null,"errorMessage":"cannot rehydrate PCollection.","messagePattern":"cannot rehydrate PCollection\\.","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":316,"sourceCode":"              .putAllEnvironments(resolveArtifacts(newEnvironmentsWithDependencies, endpoint))\n              .build();\n      expandedTransform = response.getTransform();\n      expandedRequirements = response.getRequirementsList();\n\n      RehydratedComponents rehydratedComponents =\n          RehydratedComponents.forComponents(expandedComponents).withPipeline(p);\n\n      ImmutableMap.Builder<TupleTag<?>, PCollection> outputMapBuilder = ImmutableMap.builder();\n      expandedTransform\n          .getOutputsMap()\n          .forEach(\n              (localId, pCollectionId) -> {\n                try {\n                  PCollection col = rehydratedComponents.getPCollection(pCollectionId);\n                  externalPCollectionIdMapBuilder.put(col, pCollectionId);\n                  outputMapBuilder.put(new TupleTag<>(localId), col);\n                } catch (IOException e) {\n                  throw new RuntimeException(\"cannot rehydrate PCollection.\");\n                }\n              });\n      externalPCollectionIdMap = externalPCollectionIdMapBuilder.build();\n\n      Map<Coder<?>, String> externalCoderIdMapBuilder = new HashMap<>();\n      expandedComponents\n          .getPcollectionsMap()\n          .forEach(\n              (pcolId, pCol) -> {\n                try {\n                  String coderId = pCol.getCoderId();\n                  if (isJavaSDKCompatible(expandedComponents, coderId)) {\n                    Coder<?> coder = rehydratedComponents.getCoder(coderId);\n                    externalCoderIdMapBuilder.putIfAbsent(coder, coderId);\n                  }\n                } catch (IOException e) {\n                  throw new RuntimeException(\"cannot rehydrate Coder.\");\n                }","sourceCodeStart":298,"sourceCodeEnd":334,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/External.java#L298-L334","documentation":"After a successful expansion, External.expand() rehydrates output PCollections from the returned components graph. If fetching a PCollection by id throws IOException, the proto graph is inconsistent or unreadable and the exception is swallowed and replaced by this opaque RuntimeException, losing the underlying cause.","triggerScenarios":"Expansion service returns a components graph whose output pCollection ids do not resolve during rehydratedComponents.getPCollection(pCollectionId), typically due to a malformed or version-skewed expansion response.","commonSituations":"Mismatched Beam SDK versions between pipeline and expansion service producing incompatible proto graphs; custom/broken expansion service implementations returning incomplete components.","solutions":["Align the expansion service version with the Beam SDK version used to build the pipeline.","Log/attach the expansion request/response (proto) and inspect the referenced pCollection id for presence in components.","Restart or upgrade the expansion service; if custom, verify it emits complete RunnerApi.Components.","Wrap the cause: modify to `throw new RuntimeException(\"cannot rehydrate PCollection.\", e)` to preserve the IOException for debugging."],"exampleFix":"// before\nthrow new RuntimeException(\"cannot rehydrate PCollection.\");\n// after\nthrow new RuntimeException(\"cannot rehydrate PCollection: \" + pCollectionId, e);","handlingStrategy":"try-catch","validationCode":"null","typeGuard":null,"tryCatchPattern":"try { external.expand(...); } catch (RuntimeException e) { if (\"cannot rehydrate PCollection.\".equals(e.getMessage())) { /* inspect expansion response components; version skew likely */ } throw e; }","preventionTips":["Match Beam SDK version with the expansion service","Log expansion responses when debugging cross-language transforms","If contributing to Beam, chain the IOException as cause"],"tags":["java","proto","expansion-service"],"backgroundTag":"unexpected-response-shape","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"}