{"record":{"id":"820e4eccdaafcbbf","repo":"apache/beam","slug":"could-not-find-latest-send-time-the-filter-s-matched-no","errorCode":null,"errorMessage":"Could not find latest send time. The filter %s  matched no results on HL7v2 Store: %s","messagePattern":"Could not find latest send time\\. The filter (.+?)  matched no results on HL7v2 Store: (.+?)","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/HttpHealthcareApiClient.java","lineNumber":341,"sourceCode":"  @Override\n  public Instant getLatestHL7v2SendTime(String hl7v2Store, @Nullable String filter)\n      throws IOException {\n    ListMessagesResponse response =\n        client\n            .projects()\n            .locations()\n            .datasets()\n            .hl7V2Stores()\n            .messages()\n            .list(hl7v2Store)\n            .setFilter(filter)\n            .set(\"view\", \"full\") // needed to retrieve the value for sendTime\n            .setOrderBy(\"sendTime desc\")\n            // https://cloud.google.com/apis/design/design_patterns#sorting_order\n            .setPageSize(1) // Only interested in the earliest sendTime\n            .execute();\n    if (response.isEmpty()) {\n      throw new IllegalArgumentException(\n          String.format(\n              \"Could not find latest send time. The filter %s  matched no results on \"\n                  + \"HL7v2 Store: %s\",\n              filter, hl7v2Store));\n    }\n    String sendTime = response.getHl7V2Messages().get(0).getSendTime();\n    if (Strings.isNullOrEmpty(sendTime)) {\n      LOG.warn(\"Latest message in {} has null or empty sendTime defaulting to now.\", hl7v2Store);\n\n      return Instant.now();\n    }\n    // sendTime is conveniently RFC3339 UTC \"Zulu\"\n    // https://cloud.google.com/healthcare/docs/reference/rest/v1/projects.locations.datasets.hl7V2Stores.messages#Message\n    return Instant.parse(sendTime);\n  }\n\n  @Override\n  public ListMessagesResponse makeSendTimeBoundHL7v2ListRequest(","sourceCodeStart":323,"sourceCodeEnd":359,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/HttpHealthcareApiClient.java#L323-L359","documentation":"HttpHealthcareApiClient.getLatestHL7v2SendTime is the mirror of getEarliestHL7v2SendTime: it lists messages ordered by sendTime descending with page size 1 to find the latest send time. If the filter matches no messages, the response is empty and there is no latest send time, so the method throws IllegalArgumentException naming the filter and store.","triggerScenarios":"getLatestHL7v2SendTime(store, filter) is invoked with a filter that matches zero messages in the given HL7v2 store — e.g. a sendTime >= X filter where X is later than every stored message, or a filter on a store with no data.","commonSituations":"Watermark/sync computations running against a fresh or drained store; end-time bounds from a previous run exceeding current data; wrong store resource path configured.","solutions":["Widen or remove the sendTime bounds in the filter so it can match existing messages.","Confirm the HL7v2 store resource path and that messages exist (list messages without the filter first).","Catch the IllegalArgumentException and fall back to a sensible default (e.g. current time) for empty stores.","Log the filter string and compare it against actual stored sendTime values."],"exampleFix":"// before\nInstant latest = Instant.parse(client.getLatestHL7v2SendTime(store, filter)); // throws if empty\n\n// after\nInstant latest;\ntry {\n  latest = Instant.parse(client.getLatestHL7v2SendTime(store, filter));\n} catch (IllegalArgumentException e) {\n  LOG.warn(\"Store {} empty for filter; using now\", store);\n  latest = Instant.now();\n}","handlingStrategy":"try-catch","validationCode":"// ensure at least one message matches before requesting latest send time\nListMessagesResponse page = client.listMessages(store, null, filter, 1);\nif (page.isEmpty()) { /* no matches: skip latest-send-time computation */ }","typeGuard":null,"tryCatchPattern":"try {\n  Instant latest = Instant.parse(client.getLatestHL7v2SendTime(store, filter));\n} catch (IllegalArgumentException e) {\n  latest = Instant.now(); // empty result set fallback\n}","preventionTips":["Avoid end-time filters beyond the newest stored message.","Verify store path and data presence before computing watermarks.","Use a fallback default for empty stores in sync logic."],"tags":["java","google-cloud-healthcare","hl7v2","empty-result","illegal-argument"],"backgroundTag":"empty-result-set","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"}