apache/beam · error · RuntimeException
Datadog write failed:
Error message
Datadog write failed:
What it means
Companion branch of FailOnWriteErrorFn: when a DatadogWriteError has no statusCode (null), the sink throws a generic RuntimeException with only the status message. This indicates the write failed without an HTTP status, e.g. client-side serialization or connection-level failure.
Solutions
- Inspect statusMessage for the underlying cause (connection reset, unknown host, etc.).
- Check network connectivity and Datadog endpoint reachability (proxy/firewall).
- Add retry logic with backoff around the write for transient transport failures.
- Configure a dead-letter failure handler so the pipeline does not fail outright.
Example fix
// before
// default handler throws: RuntimeException("Datadog write failed: " + message)
// after: monitor statusMessage and pre-flight connectivity
boolean reachable = java.net.InetAddress.getByName("api.datadoghq.com").isReachable(5000); Defensive patterns
Strategy: retry
Validate before calling
// Pre-flight connectivity check
boolean ok = java.net.InetAddress.getByName(datadogHost).isReachable(5000);
if (!ok) throw new IllegalStateException("Datadog endpoint unreachable: " + datadogHost); Type guard
static boolean hasTransportFailure(DatadogWriteError e) {
return e.statusCode() == null && e.statusMessage() != null;
} Try / catch
try {
write.apply(datadogTransform);
} catch (RuntimeException e) {
if (e.getMessage().startsWith("Datadog write failed: ")) {
// transport-level failure: retry with exponential backoff
}
} Prevention
- Check network/proxy/DNS reachability of the Datadog endpoint in the worker environment.
- Add retry/backoff for transient transport failures.
- Log statusMessage fully to capture the underlying I/O cause.
When it happens
Trigger: DatadogWriteError was created with a null statusCode — typically an I/O or transport failure reported by the Datadog API client — and the default error handler throws.
Common situations: Network interruptions mid-write, DNS failures, or the Datadog client surfacing an exception without an HTTP response.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- Datadog write failed with status code
- A function must be provided to convert the input type into…
- A PValue contained in
- A schema was provided without a data format (or viceversa)…
- All inherited interfaces of
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/82f0f730fa1cf36b.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/java/io/datadog/src/main/java/org/apache/beam/sdk/io/datadog/DatadogWriteSchemaTransformProvider.java:290
}
}
}
/**
* A {@link DoFn} that throws a {@link RuntimeException} when a write error is encountered,
* causing the pipeline to fail. This is the default error handling behavior when no error output
* is configured.
*/
static class FailOnWriteErrorFn extends DoFn<DatadogWriteError, Void> {
@ProcessElement
public void processElement(@Element DatadogWriteError error) {
String message = error.statusMessage();
if (error.statusCode() != null) {
throw new RuntimeException(
String.format(
"Datadog write failed with status code %d: %s", error.statusCode(), message));
} else {
throw new RuntimeException("Datadog write failed: " + message);
}
}
}
}
View on GitHub (pinned to 12126d8942)