{"record":{"id":"678bac2d1bc70f33","repo":"apache/beam","slug":"url-is-required-for-writing-events","errorCode":null,"errorMessage":"url is required for writing events.","messagePattern":"url is required for writing events\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"critical","filePath":"sdks/java/io/datadog/src/main/java/org/apache/beam/sdk/io/datadog/DatadogEventWriter.java","lineNumber":149,"sourceCode":"\n  @Nullable\n  abstract String apiKey();\n\n  @Nullable\n  abstract Integer minBatchCount();\n\n  @Nullable\n  abstract Integer inputBatchCount();\n\n  @Nullable\n  abstract Long maxBufferSize();\n\n  @Setup\n  public void setup() {\n\n    final String url = url();\n    if (url == null) {\n      throw new IllegalArgumentException(\"url is required for writing events.\");\n    }\n    checkArgument(isValidUrlFormat(url), INVALID_URL_FORMAT_MESSAGE);\n    final String apiKey = apiKey();\n    if (apiKey == null) {\n      throw new IllegalArgumentException(\"API Key is required for writing events.\");\n    }\n\n    batchCount = MoreObjects.firstNonNull(inputBatchCount(), DEFAULT_BATCH_COUNT);\n    LOG.info(\"Batch count set to: {}\", batchCount);\n\n    maxBufferSize = MoreObjects.firstNonNull(maxBufferSize(), MAX_BUFFER_SIZE);\n    LOG.info(\"Max buffer size set to: {}\", maxBufferSize);\n\n    checkArgument(\n        batchCount >= MoreObjects.firstNonNull(minBatchCount(), MIN_BATCH_COUNT),\n        \"batchCount must be greater than or equal to %s\",\n        minBatchCount());\n    checkArgument(","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/datadog/src/main/java/org/apache/beam/sdk/io/datadog/DatadogEventWriter.java#L131-L167","documentation":"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.","triggerScenarios":"Running a pipeline with DatadogIO.write() without calling withUrl(), so url() returns null at @Setup time on the worker.","commonSituations":"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.","solutions":["Call DatadogIO.write().withUrl(\"https://api.datadoghq.com/api/v1/events\") (or your region's endpoint) before applying the sink.","Wire the URL from pipeline options and pass it with withUrl(...) using ValueProvider/config at construction.","Validate configuration in main() before launching the pipeline so the failure surfaces early, not on workers."],"exampleFix":"// before\nDatadogIO.write().withApiKey(key);\n// after\nDatadogIO.write()\n    .withUrl(\"https://api.datadoghq.com/api/v1/events\")\n    .withApiKey(key);","handlingStrategy":"validation","validationCode":"if (options.getDatadogUrl() == null || !options.getDatadogUrl().startsWith(\"https://\")) {\n  throw new IllegalArgumentException(\"Datadog url required for writing events\");\n}","typeGuard":null,"tryCatchPattern":"try { sink = DatadogIO.write().withUrl(url).withApiKey(key); } catch (IllegalArgumentException e) { /* fail fast in main(), do not launch pipeline */ }","preventionTips":["Always call withUrl(...) on DatadogIO.write(); never rely on defaults.","Validate required sink config (url, apiKey) in main() before submitting the pipeline.","Use pipeline options with required-flag semantics for endpoint configuration."],"tags":["java","beam-io","datadog","missing-config","sink"],"backgroundTag":"missing-required-config-field","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"}