{"record":{"id":"7d50bbbb094465d6","repo":"apache/beam","slug":"failed-to-validate-transform-s","errorCode":null,"errorMessage":"Failed to validate transform %s","messagePattern":"Failed to validate transform (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/graph/PipelineValidator.java","lineNumber":230,"sourceCode":"          \"Transform %s references environment %s when no environment should be specified since it is a required runner implemented transform %s.\",\n          id,\n          transform.getEnvironmentId(),\n          urn);\n    }\n\n    if (Strings.isNullOrEmpty(urn)) {\n      checkArgument(\n          isComposite(transform),\n          \"Transform %s is not a composite transform but does not have a specified URN. %s\",\n          id,\n          transform);\n    }\n\n    if (VALIDATORS.containsKey(urn)) {\n      try {\n        VALIDATORS.get(urn).validate(id, transform, components, requirements);\n      } catch (Exception e) {\n        throw new RuntimeException(String.format(\"Failed to validate transform %s\", id), e);\n      }\n    }\n  }\n\n  private static void validateParDo(\n      String id, PTransform transform, Components components, Set<String> requirements)\n      throws Exception {\n    ParDoPayload payload = ParDoPayload.parseFrom(transform.getSpec().getPayload());\n    // side_inputs\n    for (String sideInputId : payload.getSideInputsMap().keySet()) {\n      checkArgument(\n          transform.containsInputs(sideInputId),\n          \"Transform %s side input %s is not listed in the transform's inputs\",\n          id,\n          sideInputId);\n    }\n    if (payload.getStateSpecsCount() > 0 || payload.getTimerFamilySpecsCount() > 0) {\n      checkArgument(requirements.contains(ParDoTranslation.REQUIRES_STATEFUL_PROCESSING_URN));","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/graph/PipelineValidator.java#L212-L248","documentation":"Thrown as a RuntimeException wrapping any Exception raised by a per-URN validator in PipelineValidator.validateTransform. It indicates a transform in the pipeline proto failed its URN-specific validation (wrong coders, missing inputs/outputs, malformed subtransforms), and the original cause is attached as the supressed cause.","triggerScenarios":"Validating a pipeline (validateComponents) where a PTransform with a registered URN fails VALIDATORS.get(urn).validate — e.g. missing required inputs, coder mismatches, unsupported payload structure.","commonSituations":"Hand-built pipeline protos; graph rewrites that broke transform contracts; runner-side validation of pipelines constructed by SDKs with bugs; inspect the cause to find the real problem.","solutions":["Read the chained cause exception — it names the actual validation failure for the transform URN.","Fix the transform's inputs/outputs/coders per the cause (e.g. ensure required inputs are connected).","Regenerate the pipeline proto with the SDK instead of hand-editing it.","Run validation earlier in development (unit test using PipelineValidator) to catch construction bugs."],"exampleFix":"// before: transform missing required input\nPTransform.newBuilder().setUrn(\"beam:transform:flatten:v1\")... // no inputs\n// after\nPTransform.newBuilder().setUrn(\"beam:transform:flatten:v1\")\n    .putInputs(\"in0\", pcollId0).putInputs(\"in1\", pcollId1)...","handlingStrategy":"try-catch","validationCode":"// pre-check common validator requirements before validation\nfor (PTransformNode t : pipeline.getTransforms()) {\n  if (t.getTransform().getInputsCount() == 0 && REQUIRES_INPUT_URNS.contains(t.getTransform().getUrn())) throw new IllegalArgumentException(\"Transform \" + t.getId() + \" has no inputs\");\n}","typeGuard":"boolean transformHasRequiredIO(RunnerApi.PTransform t) { return t.getInputsCount() > 0 && t.getOutputsCount() > 0; }","tryCatchPattern":"try { validatePipeline(pipeline); } catch (RuntimeException e) { Throwable cause = e.getCause(); log.error(\"Transform {} failed validation: {}\", id, cause == null ? e : cause.getMessage(), cause); throw e; }","preventionTips":["Always inspect the cause chain — this exception wraps the real validation error","Validate pipelines in unit tests during construction, not only at submission","Avoid hand-editing pipeline protos; regenerate via the SDK"],"tags":["java","beam","validation","pipeline","transform"],"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-14T16:17:12.679Z"}