apache/beam · critical · IllegalArgumentException

url is required for writing events.

Error message

url is required for writing events.

What it means

DatadogEventWriter.setup() resolves the Datadog API endpoint URL from the transform's configuration and throws IllegalArgumentException if it is null. Writing events requires an endpoint (e.g. https://api.datadoghq.com/api/v1/events), which must be supplied via DatadogIO.write().withUrl(...) (or a configured default), otherwise the writer cannot post events.

Solutions

  1. Call DatadogIO.write().withUrl("https://api.datadoghq.com/api/v1/events") (or your region's endpoint) before applying the sink.
  2. Wire the URL from pipeline options and pass it with withUrl(...) using ValueProvider/config at construction.
  3. Validate configuration in main() before launching the pipeline so the failure surfaces early, not on workers.

Example fix

// before
DatadogIO.write().withApiKey(key);
// after
DatadogIO.write()
    .withUrl("https://api.datadoghq.com/api/v1/events")
    .withApiKey(key);
Defensive patterns

Strategy: validation

Validate before calling

if (options.getDatadogUrl() == null || !options.getDatadogUrl().startsWith("https://")) {
  throw new IllegalArgumentException("Datadog url required for writing events");
}

Try / catch

try { sink = DatadogIO.write().withUrl(url).withApiKey(key); } catch (IllegalArgumentException e) { /* fail fast in main(), do not launch pipeline */ }

Prevention

When it happens

Trigger: Running a pipeline with DatadogIO.write() without calling withUrl(), so url() returns null at @Setup time on the worker.

Common situations: Assuming a region default that isn't set; URL provided only via a runtime parameter that isn't wired into the sink; copying a DatadogIO.read() setup (which needs a different endpoint config) for writes.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at sdks/java/io/datadog/src/main/java/org/apache/beam/sdk/io/datadog/DatadogEventWriter.java:149

  @Nullable
  abstract String apiKey();

  @Nullable
  abstract Integer minBatchCount();

  @Nullable
  abstract Integer inputBatchCount();

  @Nullable
  abstract Long maxBufferSize();

  @Setup
  public void setup() {

    final String url = url();
    if (url == null) {
      throw new IllegalArgumentException("url is required for writing events.");
    }
    checkArgument(isValidUrlFormat(url), INVALID_URL_FORMAT_MESSAGE);
    final String apiKey = apiKey();
    if (apiKey == null) {
      throw new IllegalArgumentException("API Key is required for writing events.");
    }

    batchCount = MoreObjects.firstNonNull(inputBatchCount(), DEFAULT_BATCH_COUNT);
    LOG.info("Batch count set to: {}", batchCount);

    maxBufferSize = MoreObjects.firstNonNull(maxBufferSize(), MAX_BUFFER_SIZE);
    LOG.info("Max buffer size set to: {}", maxBufferSize);

    checkArgument(
        batchCount >= MoreObjects.firstNonNull(minBatchCount(), MIN_BATCH_COUNT),
        "batchCount must be greater than or equal to %s",
        minBatchCount());
    checkArgument(

View on GitHub (pinned to 12126d8942)