{"record":{"id":"107ec21e5d84abfa","repo":"apache/beam","slug":"error-executing-getpatienteverything-fhir-resources-writing","errorCode":null,"errorMessage":"Error executing GetPatientEverything: FHIR resources writing to Dead Letter Queue.","messagePattern":"Error executing GetPatientEverything: FHIR resources writing to Dead Letter Queue\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/FhirIOPatientEverything.java","lineNumber":210,"sourceCode":"     *\n     * @throws IOException the io exception\n     */\n    @Setup\n    public void instantiateHealthcareClient() throws IOException {\n      this.client = new HttpHealthcareApiClient();\n    }\n\n    @ProcessElement\n    public void processElement(ProcessContext context) {\n      PatientEverythingParameter patientEverythingParameter = context.element();\n      try {\n        context.output(\n            getPatientEverything(\n                patientEverythingParameter.getResourceName(),\n                patientEverythingParameter.getFilters()));\n      } catch (IllegalArgumentException | NoSuchElementException e) {\n        GET_PATIENT_EVERYTHING_ERROR_COUNT.inc();\n        LOG.warn(\n            \"Error executing GetPatientEverything: FHIR resources writing to Dead Letter Queue.\",\n            e);\n        context.output(DEAD_LETTER, HealthcareIOError.of(patientEverythingParameter.toString(), e));\n      }\n    }\n\n    private JsonArray getPatientEverything(\n        String resourceName, @Nullable Map<String, String> filters) {\n      long start = Instant.now().toEpochMilli();\n\n      HashMap<String, Object> filterObjects = new HashMap<>();\n      if (filters != null) {\n        filterObjects.putAll(filters);\n      }\n      FhirResourcePagesIterator iter =\n          FhirResourcePagesIterator.ofPatientEverything(client, resourceName, filterObjects);\n      JsonArray result = new JsonArray();\n      while (iter.hasNext()) {","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/FhirIOPatientEverything.java#L192-L228","documentation":"FhirIOPatientEverything's processElement invokes the Patient/$everything operation for a given Patient resource name. When the request parameters are invalid (IllegalArgumentException) or the result is unexpectedly empty causing NoSuchElementException, the error counter is incremented, this warning logged, and the failing parameter is emitted to the DEAD_LETTER output as a HealthcareIOError instead of failing the pipeline.","triggerScenarios":"Calling FhirIOPatientEverything with a resourceName that is not a valid Patient reference (wrong path shape, wrong resource type), invalid filter definitions, or an empty/incomplete Patient where the client expects at least one entry.","commonSituations":"Building Patient references from inconsistent upstream fields (e.g. plain IDs instead of projects/.../patients/{id}); filters using unsupported FHIR search parameters; patients deleted before the everything call.","solutions":["Inspect DEAD_LETTER output for the offending PatientEverythingParameter and exception detail.","Ensure resourceName is a fully-qualified Patient path: projects/{p}/locations/{l}/datasets/{d}/fhirStores/{s}/fhir/Patient/{id}.","Validate filters use search parameters supported by $everything for your store version.","Skip or re-queue patients whose resources no longer exist."],"exampleFix":"// before\nString name = patientId; // bare id\n// after\nString name = String.format(\"projects/%s/locations/%s/datasets/%s/fhirStores/%s/fhir/Patient/%s\", project, location, dataset, store, patientId);","handlingStrategy":"validation","validationCode":"// Java: validate Patient resourceName before calling $everything\njava.util.regex.Pattern P = java.util.regex.Pattern.compile(\n    \"projects/[^/]+/locations/[^/]+/datasets/[^/]+/fhirStores/[^/]+/fhir/Patient/[^/]+\");\nif (!P.matcher(resourceName).matches()) {\n  throw new IllegalArgumentException(\"Not a fully-qualified Patient resource name: \" + resourceName);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always build fully-qualified Patient resource names.","Monitor FhirIOPatientEverything DEAD_LETTER output.","Validate filters against supported $everything search parameters.","Exclude deleted/nonexistent patients before the call."],"tags":["gcp-healthcare","fhir","patient-everything","dead-letter"],"backgroundTag":"invalid-identifier-format","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"}