apache/beam · error · IllegalArgumentException
Could not find earliest send time. The filter %s matched no
Error message
Could not find earliest send time. The filter %s matched no results on HL7v2 Store: %s
What it means
HttpHealthcareApiClient.getEarliestHL7v2SendTime queries the HL7v2 store listing messages ordered by sendTime ascending with page size 1 to find the earliest send time. If the filtered listing returns an empty response (no messages matched the filter), it throws IllegalArgumentException because the earliest send time is undefined for an empty result set.
Source
Thrown at sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/HttpHealthcareApiClient.java:306
@Override
public Instant getEarliestHL7v2SendTime(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") // default order is ascending
// 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 earliest 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(
"Earliest message in {} has null or empty sendTime defaulting to Epoch.", hl7v2Store);
return Instant.ofEpochMilli(0);
}
// 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 Instant getLatestHL7v2SendTime(String hl7v2Store, @Nullable String filter)View on GitHub (pinned to 12126d8942)
Solutions
- Validate the filter's time range covers stored data, or omit/guard the sendTime filter when the store may be empty.
- Check the store path is correct and contains messages (list a page first, or catch empty results).
- Wrap the call in try-catch for IllegalArgumentException and treat empty stores as 'no earliest send time' (use epoch/now) in your pipeline logic.
- Inspect the generated filter string (logging it) to confirm it matches the expected message set.
Example fix
// before
Instant earliest = Instant.parse(client.getEarliestHL7v2SendTime(store, filter)); // throws on empty
// after
Instant earliest;
try {
earliest = Instant.parse(client.getEarliestHL7v2SendTime(store, filter));
} catch (IllegalArgumentException e) {
LOG.warn("No messages matched filter on {}", store);
earliest = Instant.EPOCH;
} Defensive patterns
Strategy: try-catch
Validate before calling
// check store non-empty before querying earliest send time
ListMessagesResponse page = client.listMessages(store, null, "", 1);
if (page.isEmpty()) { /* store empty: skip earliest-send-time computation */ } Try / catch
try {
Instant earliest = Instant.parse(client.getEarliestHL7v2SendTime(store, filter));
} catch (IllegalArgumentException e) {
earliest = Instant.EPOCH; // empty result set
} Prevention
- Guard against empty stores before computing send-time bounds.
- Sanity-check filter time ranges against actual data.
- Log the filter string so mismatches are diagnosable.
When it happens
Trigger: getEarliestHL7v2SendTime(store, filter) is called with a filter that matches zero messages — typically a sendTime window filter that excludes all stored messages (e.g. searching for messages sent after a timestamp when none exist, or a filter on the wrong store).
Common situations: Sync/backfill jobs computing a watermark on an empty or newly created HL7v2 store; filters built with start/end times that fall outside all stored messages; pointing at a store other than the one holding the data.
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 latest send time. The filter %s matched no r
- 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/036c8863080c3d54.
Report an issue: GitHub.