apache/beam · error · IllegalArgumentException
The PCollection tuple bodies must have the FhirIO.Write.SUCC
Error message
The PCollection tuple bodies must have the FhirIO.Write.SUCCESSFUL_BODY and FhirIO.Write.FAILED_BODY tuple tags.
What it means
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.
Source
Thrown at sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/FhirIO.java:711
public static class Result extends AbstractResult {
private final Pipeline pipeline;
private final PCollection<String> successfulBodies;
private final PCollection<HealthcareIOError<String>> failedBodies;
private final PCollection<HealthcareIOError<String>> failedFiles;
/**
* Creates a {@link FhirIO.Write.Result} in the given {@link Pipeline}.
*
* @param pipeline the pipeline
* @param bodies the successful and failing bodies results.
* @return the result
*/
static Result in(Pipeline pipeline, PCollectionTuple bodies) throws IllegalArgumentException {
if (bodies.has(SUCCESSFUL_BODY) && bodies.has(FAILED_BODY)) {
return new Result(pipeline, bodies.get(SUCCESSFUL_BODY), bodies.get(FAILED_BODY), null);
} else {
throw new IllegalArgumentException(
"The PCollection tuple bodies must have the FhirIO.Write.SUCCESSFUL_BODY "
+ "and FhirIO.Write.FAILED_BODY tuple tags.");
}
}
static Result in(
Pipeline pipeline,
PCollection<HealthcareIOError<String>> failedBodies,
PCollection<HealthcareIOError<String>> failedFiles) {
return new Result(pipeline, null, failedBodies, failedFiles);
}
/**
* Gets successful bodies from Write.
*
* @return the entries that were inserted
*/
@OverrideView on GitHub (pinned to 12126d8942)
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
Example fix
// before PCollectionTuple bodies = PCollectionTuple.of(FhirIO.Write.SUCCESSFUL_BODY, ok); FhirIO.Write.Result r = FhirIO.Write.Result.in(pipeline, bodies); // throws // after bodies.put(FhirIO.Write.FAILED_BODY, failed); FhirIO.Write.Result r = FhirIO.Write.Result.in(pipeline, bodies);
Defensive patterns
Strategy: validation
Validate before calling
if (bodies.has(FhirIO.Write.SUCCESSFUL_BODY) && bodies.has(FhirIO.Write.FAILED_BODY)) {
FhirIO.Write.Result r = FhirIO.Write.Result.in(pipeline, bodies);
} Try / catch
try {
FhirIO.Write.Result r = FhirIO.Write.Result.in(pipeline, bodies);
} catch (IllegalArgumentException e) {
LOG.error("Tuple missing SUCCESSFUL_BODY/FAILED_BODY tags", e);
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- The PCollection tuple must have the FhirIO.Read.OUT and Fhir
- The PCollection tuple must have the FhirIO.Search.OUT and Fh
- The PCollection tuple must have the DicomIO.ReadStudyMetadat
- GET request for %s returned null
- Not all temporary files are present for importing.
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/4dc9a783facb7357.
Report an issue: GitHub.