{"record":{"id":"0424554abf31c276","repo":"apache/beam","slug":"cannot-rehydrate-coder","errorCode":null,"errorMessage":"cannot rehydrate Coder.","messagePattern":"cannot rehydrate Coder\\.","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":333,"sourceCode":"                } 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                }\n              });\n      externalCoderIdMap = ImmutableMap.copyOf(externalCoderIdMapBuilder);\n\n      return toOutputCollection(outputMapBuilder.build());\n    }\n\n    static Map<String, RunnerApi.Environment> resolveArtifacts(\n        Map<String, RunnerApi.Environment> environments, Endpoints.ApiServiceDescriptor endpoint) {\n      if (environments.size() == 0) {\n        return environments;\n      }\n      ManagedChannel channel =\n          ManagedChannelBuilder.forTarget(endpoint.getUrl())\n              .usePlaintext()\n              .maxInboundMessageSize(Integer.MAX_VALUE)\n              .build();\n      try {","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/External.java#L315-L351","documentation":"During External.expand(), coders referenced by expanded output PCollections are rehydrated so Java can map them back to coder ids. An IOException from rehydratedComponents.getCoder(coderId) is caught and rethrown as this opaque RuntimeException, meaning the returned coder graph referenced a coder that could not be constructed.","triggerScenarios":"The expansion response contains a pCollection whose coderId is absent from components.coders or whose payload cannot be parsed into a Java Coder during expansion of a cross-language transform.","commonSituations":"Cross-language transforms emitting coders unknown to the Java SDK; version skew between SDK and expansion service; custom coders not registered on the Java side.","solutions":["Check isJavaSDKCompatible filtering and ensure the transform's outputs use Java-compatible coders.","Align Beam SDK and expansion service versions so coder proto definitions match.","Register the missing custom coder with the Java SDK (CoderProvider) so it can be constructed.","Preserve the cause: `throw new RuntimeException(\"cannot rehydrate Coder.\", e)` when editing this code path."],"exampleFix":"// before\nthrow new RuntimeException(\"cannot rehydrate Coder.\");\n// after\nthrow new RuntimeException(\"cannot rehydrate Coder: \" + coderId, e);","handlingStrategy":"try-catch","validationCode":"null","typeGuard":null,"tryCatchPattern":"try { external.expand(...); } catch (RuntimeException e) { if (\"cannot rehydrate Coder.\".equals(e.getMessage())) { /* check coder registration / SDK version skew */ } throw e; }","preventionTips":["Register custom coders via CoderProvider with the Java SDK","Keep expansion service and SDK versions matched","Prefer standard coders for cross-language transform outputs"],"tags":["java","coder","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"}