{"record":{"id":"7e6fb01394d6f887","repo":"apache/beam","slug":"original-transform-had-an-output-with-tag-but-upgraded","errorCode":null,"errorMessage":"Original transform had an output with tag  but upgraded transform did not.","messagePattern":"Original transform had an output with tag  but upgraded transform did not\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/TransformUpgrader.java","lineNumber":311,"sourceCode":"        UPGRADE_KEY, ByteString.copyFromUtf8(transformServiceVersion));\n    expandedTransform = expandedTransformBuilder.build();\n\n    List<String> expandedRequirements = response.getRequirementsList();\n\n    RunnerApi.Components.Builder newComponentsBuilder = expandedComponents.toBuilder();\n\n    // We record transforms that consume outputs of the old transform and update them to consume\n    // outputs of the new (upgraded) transform.\n    Collection<String> oldOutputs = transformToUpgrade.getOutputsMap().values();\n    Map<String, String> inputReplacements = new HashMap<>();\n    if (transformToUpgrade.getOutputsMap().size() == 1) {\n      inputReplacements.put(\n          oldOutputs.iterator().next(),\n          expandedTransform.getOutputsMap().values().iterator().next());\n    } else {\n      for (Map.Entry<String, String> entry : transformToUpgrade.getOutputsMap().entrySet()) {\n        if (!expandedTransform.getOutputsMap().keySet().contains(entry.getKey())) {\n          throw new IllegalArgumentException(\n              \"Original transform had an output with tag \"\n                  + entry.getKey()\n                  + \" but upgraded transform did not.\");\n        }\n        String newOutput = expandedTransform.getOutputsMap().get(entry.getKey());\n        if (newOutput == null) {\n          throw new IllegalArgumentException(\n              \"Could not find an output with tag \"\n                  + entry.getKey()\n                  + \" for the transform \"\n                  + expandedTransform);\n        }\n        inputReplacements.put(entry.getValue(), newOutput);\n      }\n    }\n\n    // The list of obsolete (overridden) transforms that should be removed from the pipeline\n    // produced by this method.","sourceCodeStart":293,"sourceCodeEnd":329,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/TransformUpgrader.java#L293-L329","documentation":"TransformUpgrader.updateTransformViaTransformService compares the output tags of the original PTransform against the upgraded (expanded) transform returned by the transform service. If any output tag present in the original transform's outputsMap is missing from the expanded transform's outputsMap, the upgrade is invalid and the pipeline would be corrupted, so an IllegalArgumentException is thrown.","triggerScenarios":"Calling TransformUpgrader.upgradeTransformsViaTransformService where a transform scheduled for upgrade declares an output PCollection tag that the upgraded transform definition no longer produces.","commonSituations":"The transform service returns a newer/different version of the transform whose output schema changed (a tag was renamed or removed); hand-edited or stale pipeline graph files referencing outdated transform outputs.","solutions":["Ensure the upgraded transform definition preserves all output tags of the original transform","Pin the transform service / expansion service to a compatible version whose output contract matches the pipeline","Inspect the transform's outputsMap vs the expanded transform's outputsMap to find the removed/renamed tag and update the pipeline graph accordingly"],"exampleFix":"// before: upgraded transform drops tag 'out2'\n// after: ensure expanded transform's OutputsMap contains every key of the original:\n// original: {out1: pc1, out2: pc2}\n// expanded must map: {out1: ..., out2: ...}","handlingStrategy":"validation","validationCode":"for (String tag : originalTransform.getOutputsMap().keySet()) {\n  if (!expandedTransform.getOutputsMap().containsKey(tag)) {\n    throw new IllegalStateException(\"Upgraded transform missing output tag: \" + tag);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  upgrader.upgradeTransformsViaTransformService(pipeline, ids, service);\n} catch (IllegalArgumentException e) {\n  // handle missing output tag in upgraded transform\n}","preventionTips":["Keep the transform service version aligned with the SDK that built the pipeline","Diff original vs expanded outputsMap tags before applying upgrades"],"tags":["java","beam","pipeline-construction","transform-upgrade"],"backgroundTag":"schema-validation-failed","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"}