apache/beam · error · IllegalArgumentException
Could not find latest send time. The filter %s matched no r
Error message
Could not find latest send time. The filter %s matched no results on HL7v2 Store: %s
What it means
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.
Source
Thrown at sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/HttpHealthcareApiClient.java:341
@Override
public Instant getLatestHL7v2SendTime(String hl7v2Store, @Nullable String filter)
throws IOException {
ListMessagesResponse response =
client
.projects()
.locations()
.datasets()
.hl7V2Stores()
.messages()
.list(hl7v2Store)
.setFilter(filter)
.set("view", "full") // needed to retrieve the value for sendTime
.setOrderBy("sendTime desc")
// https://cloud.google.com/apis/design/design_patterns#sorting_order
.setPageSize(1) // Only interested in the earliest sendTime
.execute();
if (response.isEmpty()) {
throw new IllegalArgumentException(
String.format(
"Could not find latest send time. The filter %s matched no results on "
+ "HL7v2 Store: %s",
filter, hl7v2Store));
}
String sendTime = response.getHl7V2Messages().get(0).getSendTime();
if (Strings.isNullOrEmpty(sendTime)) {
LOG.warn("Latest message in {} has null or empty sendTime defaulting to now.", hl7v2Store);
return Instant.now();
}
// sendTime is conveniently RFC3339 UTC "Zulu"
// https://cloud.google.com/healthcare/docs/reference/rest/v1/projects.locations.datasets.hl7V2Stores.messages#Message
return Instant.parse(sendTime);
}
@Override
public ListMessagesResponse makeSendTimeBoundHL7v2ListRequest(View on GitHub (pinned to 12126d8942)
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.
Example fix
// before
Instant latest = Instant.parse(client.getLatestHL7v2SendTime(store, filter)); // throws if empty
// after
Instant latest;
try {
latest = Instant.parse(client.getLatestHL7v2SendTime(store, filter));
} catch (IllegalArgumentException e) {
LOG.warn("Store {} empty for filter; using now", store);
latest = Instant.now();
} Defensive patterns
Strategy: try-catch
Validate before calling
// ensure at least one message matches before requesting latest send time
ListMessagesResponse page = client.listMessages(store, null, filter, 1);
if (page.isEmpty()) { /* no matches: skip latest-send-time computation */ } Try / catch
try {
Instant latest = Instant.parse(client.getLatestHL7v2SendTime(store, filter));
} catch (IllegalArgumentException e) {
latest = Instant.now(); // empty result set fallback
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- Could not find earliest send time. The filter %s matched no
- The PCollection tuple must have the HL7v2IO.Read.OUT and HL7
- The PCollection tuple must have the HL7v2IO.HL7v2Read.OUT an
- The PCollection tuple must have the FhirIOPatientEverything.
- GET request for %s returned null
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/820e4eccdaafcbbf.
Report an issue: GitHub.