apache/beam · info

{} {}

Error message

{} {}

What it means

Companion log to 'Failed to ingest message': after a failed HL7v2 ingestion, the pipeline logs the HealthcareIOError's error message and stack trace via a generic '{} {}' format. It is diagnostic output only, immediately followed by emitting the error to the error output PCollection.

Solutions

  1. Read this log line's first placeholder (err.getErrorMessage()) to learn the concrete ingestion failure cause
  2. Set up a sink on the error output PCollection to persist errors for analysis instead of relying on worker logs
  3. Fix the root cause identified (permissions, store path, message validity) and replay the failed messages

Example fix

// before
LOG.warn("{} {}", err.getErrorMessage(), err.getStackTrace());
// after
LOG.warn("Failed to ingest HL7v2 message {}: {}", msg.getId(), err.getErrorMessage(), err);
Defensive patterns

Strategy: try-catch

Validate before calling

// same guard as the ingest call
if (!isValidHl7v2(model)) throw new IllegalArgumentException("malformed HL7v2 payload");

Try / catch

catch (Exception e) {
  HealthcareIOError<HL7v2Message> err = HealthcareIOError.of(msg, e);
  LOG.warn("HL7v2 ingest failed for {}: {}", msg.getId(), err.getErrorMessage(), e);
  context.output(err);
}

Prevention

When it happens

Trigger: Same as error 6053: any Exception from client.ingestHL7v2Message in the HL7v2IO Write DoFn; this line fires right after the failure is recorded.

Common situations: Debugging pipelines where HL7v2 messages land on the error output — this line carries the detailed reason (API status, parse failure) that the first log line omits.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/6d5ed8ad746a5b90. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/io/google-cloud-platform/src/main/java/org/apache/beam/sdk/io/gcp/healthcare/HL7v2IO.java:962

        Message model = new Message();
        model.setData(msg.getData());
        model.setLabels(msg.getLabels());
        switch (writeMethod) {
          case BATCH_IMPORT:
            // TODO: add support for HL7v2 import.
            throw new UnsupportedOperationException("The batch import API is not supported yet");
          case INGEST:
          default:
            try {
              long requestTimestamp = Instant.now().getMillis();
              client.ingestHL7v2Message(hl7v2Store.get(), model);
              successfulHL7v2MessageWrites.inc();
              messageIngestLatencyMs.update(Instant.now().getMillis() - requestTimestamp);
            } catch (Exception e) {
              failedMessageWrites.inc();
              LOG.warn("Failed to ingest message", e);
              HealthcareIOError<HL7v2Message> err = HealthcareIOError.of(msg, e);
              LOG.warn("{} {}", err.getErrorMessage(), err.getStackTrace());
              context.output(err);
            }
        }
      }
    }
  }
}

View on GitHub (pinned to 12126d8942)