{"record":{"id":"82f0f730fa1cf36b","repo":"apache/beam","slug":"datadog-write-failed","errorCode":null,"errorMessage":"Datadog write failed: ","messagePattern":"Datadog write failed: ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/datadog/src/main/java/org/apache/beam/sdk/io/datadog/DatadogWriteSchemaTransformProvider.java","lineNumber":290,"sourceCode":"      }\n    }\n  }\n\n  /**\n   * A {@link DoFn} that throws a {@link RuntimeException} when a write error is encountered,\n   * causing the pipeline to fail. This is the default error handling behavior when no error output\n   * is configured.\n   */\n  static class FailOnWriteErrorFn extends DoFn<DatadogWriteError, Void> {\n    @ProcessElement\n    public void processElement(@Element DatadogWriteError error) {\n      String message = error.statusMessage();\n      if (error.statusCode() != null) {\n        throw new RuntimeException(\n            String.format(\n                \"Datadog write failed with status code %d: %s\", error.statusCode(), message));\n      } else {\n        throw new RuntimeException(\"Datadog write failed: \" + message);\n      }\n    }\n  }\n}\n","sourceCodeStart":272,"sourceCodeEnd":295,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/datadog/src/main/java/org/apache/beam/sdk/io/datadog/DatadogWriteSchemaTransformProvider.java#L272-L295","documentation":"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.","triggerScenarios":"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.","commonSituations":"Network interruptions mid-write, DNS failures, or the Datadog client surfacing an exception without an HTTP response.","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."],"exampleFix":"// before\n// default handler throws: RuntimeException(\"Datadog write failed: \" + message)\n// after: monitor statusMessage and pre-flight connectivity\nboolean reachable = java.net.InetAddress.getByName(\"api.datadoghq.com\").isReachable(5000);","handlingStrategy":"retry","validationCode":"// Pre-flight connectivity check\nboolean ok = java.net.InetAddress.getByName(datadogHost).isReachable(5000);\nif (!ok) throw new IllegalStateException(\"Datadog endpoint unreachable: \" + datadogHost);","typeGuard":"static boolean hasTransportFailure(DatadogWriteError e) {\n  return e.statusCode() == null && e.statusMessage() != null;\n}","tryCatchPattern":"try {\n  write.apply(datadogTransform);\n} catch (RuntimeException e) {\n  if (e.getMessage().startsWith(\"Datadog write failed: \")) {\n    // transport-level failure: retry with exponential backoff\n  }\n}","preventionTips":["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."],"tags":["java","apache-beam","datadog","network"],"backgroundTag":"http-error-response","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}