{"record":{"id":"4dc9a783facb7357","repo":"apache/beam","slug":"the-pcollection-tuple-bodies-must-have-the-fhirio-write","errorCode":null,"errorMessage":"The PCollection tuple bodies must have the FhirIO.Write.SUCCESSFUL_BODY and FhirIO.Write.FAILED_BODY tuple tags.","messagePattern":"The PCollection tuple bodies must have the FhirIO\\.Write\\.SUCCESSFUL_BODY and FhirIO\\.Write\\.FAILED_BODY tuple tags\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/FhirIO.java","lineNumber":711,"sourceCode":"    public static class Result extends AbstractResult {\n\n      private final Pipeline pipeline;\n      private final PCollection<String> successfulBodies;\n      private final PCollection<HealthcareIOError<String>> failedBodies;\n      private final PCollection<HealthcareIOError<String>> failedFiles;\n\n      /**\n       * Creates a {@link FhirIO.Write.Result} in the given {@link Pipeline}.\n       *\n       * @param pipeline the pipeline\n       * @param bodies the successful and failing bodies results.\n       * @return the result\n       */\n      static Result in(Pipeline pipeline, PCollectionTuple bodies) throws IllegalArgumentException {\n        if (bodies.has(SUCCESSFUL_BODY) && bodies.has(FAILED_BODY)) {\n          return new Result(pipeline, bodies.get(SUCCESSFUL_BODY), bodies.get(FAILED_BODY), null);\n        } else {\n          throw new IllegalArgumentException(\n              \"The PCollection tuple bodies must have the FhirIO.Write.SUCCESSFUL_BODY \"\n                  + \"and FhirIO.Write.FAILED_BODY tuple tags.\");\n        }\n      }\n\n      static Result in(\n          Pipeline pipeline,\n          PCollection<HealthcareIOError<String>> failedBodies,\n          PCollection<HealthcareIOError<String>> failedFiles) {\n        return new Result(pipeline, null, failedBodies, failedFiles);\n      }\n\n      /**\n       * Gets successful bodies from Write.\n       *\n       * @return the entries that were inserted\n       */\n      @Override","sourceCodeStart":693,"sourceCodeEnd":729,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/FhirIO.java#L693-L729","documentation":"FhirIO.Write.Result.in(pipeline, bodies) validates that the PCollectionTuple of request bodies contains both the FhirIO.Write.SUCCESSFUL_BODY and FhirIO.Write.FAILED_BODY TupleTags. The Write transform partitions input bodies into successful and failed streams, so without both tags the Result cannot wire up its outputs and an IllegalArgumentException is thrown. This is a fail-fast check at pipeline-construction time.","triggerScenarios":"Calling FhirIO.Write.Result.in() with a PCollectionTuple missing SUCCESSFUL_BODY or FAILED_BODY — typically a tuple built manually or reusing a Write result's tags incorrectly.","commonSituations":"Hand-assembling the PCollectionTuple instead of using the output of a prior FhirIO.Write result; only needing the success stream and omitting the failed-body tag; refactoring that renamed tags.","solutions":["Populate the tuple with both tags: bodies.apply(FhirIO.Write.SUCCESSFUL_BODY, okBodies) and bodies.apply(FhirIO.Write.FAILED_BODY, failedBodies)","Use the constant TupleTags FhirIO.Write.SUCCESSFUL_BODY / FhirIO.Write.FAILED_BODY, not newly instantiated TupleTags with similar names","Check the two-argument Result.in overload or use the write transform's own Result return value","Guard with bodies.has(SUCCESSFUL_BODY) && bodies.has(FAILED_BODY) in development builds"],"exampleFix":"// before\nPCollectionTuple bodies = PCollectionTuple.of(FhirIO.Write.SUCCESSFUL_BODY, ok);\nFhirIO.Write.Result r = FhirIO.Write.Result.in(pipeline, bodies); // throws\n// after\nbodies.put(FhirIO.Write.FAILED_BODY, failed);\nFhirIO.Write.Result r = FhirIO.Write.Result.in(pipeline, bodies);","handlingStrategy":"validation","validationCode":"if (bodies.has(FhirIO.Write.SUCCESSFUL_BODY) && bodies.has(FhirIO.Write.FAILED_BODY)) {\n  FhirIO.Write.Result r = FhirIO.Write.Result.in(pipeline, bodies);\n}","typeGuard":null,"tryCatchPattern":"try {\n  FhirIO.Write.Result r = FhirIO.Write.Result.in(pipeline, bodies);\n} catch (IllegalArgumentException e) {\n  LOG.error(\"Tuple missing SUCCESSFUL_BODY/FAILED_BODY tags\", e);\n}","preventionTips":["Always wire both SUCCESSFUL_BODY and FAILED_BODY tags, even if only one stream is consumed","Use the library constants, never new TupleTag<>(...) look-alikes","Add a wiring unit test before submitting the pipeline"],"tags":["java","fhir","healthcare","pcollection-tuple"],"backgroundTag":"missing-required-argument","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"}