apache/beam · error · IllegalArgumentException

Column headers should be supplied when delimiter is present.

Error message

Column headers should be supplied when delimiter is present.

What it means

DLPReidentifyText.Builder.build() enforces the inverse of the previous check: if a columnDelimiter is supplied, headerColumns must also be supplied, since a delimiter alone has no meaning for header construction in the reidentified output. Setting only the delimiter throws IllegalArgumentException.

Source

Thrown at sdks/java/extensions/ml/src/main/java/org/apache/beam/sdk/extensions/ml/DLPReidentifyText.java:184

      if (dlpReidentifyText.getReidentifyConfig() == null
          && dlpReidentifyText.getReidentifyTemplateName() == null) {
        throw new IllegalArgumentException(
            "Either reidentifyConfig or reidentifyTemplateName need to be set!");
      }
      if (dlpReidentifyText.getBatchSizeBytes() > DLP_PAYLOAD_LIMIT_BYTES) {
        throw new IllegalArgumentException(
            String.format(
                "Batch size is too large! It should be smaller or equal than %d.",
                DLP_PAYLOAD_LIMIT_BYTES));
      }
      if (dlpReidentifyText.getColumnDelimiter() == null
          && dlpReidentifyText.getHeaderColumns() != null) {
        throw new IllegalArgumentException(
            "Column delimiter should be set if headers are present.");
      }
      if (dlpReidentifyText.getHeaderColumns() == null
          && dlpReidentifyText.getColumnDelimiter() != null) {
        throw new IllegalArgumentException(
            "Column headers should be supplied when delimiter is present.");
      }
      return dlpReidentifyText;
    }
  }

  public static DLPReidentifyText.Builder newBuilder() {
    return new AutoValue_DLPReidentifyText.Builder();
  }

  /**
   * The transform converts the contents of input PCollection into {@link Table.Row}s and then calls
   * Cloud DLP service to perform the reidentification according to provided settings.
   *
   * @param input input PCollection
   * @return PCollection after transformations
   */
  @Override

View on GitHub (pinned to 12126d8942)

Solutions

  1. Add .setHeaderColumns(...) listing the table's column names when setting a columnDelimiter.
  2. If headers are unnecessary, remove setColumnDelimiter(...) so neither is set.
  3. Validate your options object so delimiter and headers are always provided as a pair.

Example fix

// before
DLPReidentifyText.newBuilder().setColumnDelimiter(",").build();
// after
DLPReidentifyText.newBuilder()
    .setColumnDelimiter(",")
    .setHeaderColumns(ImmutableList.of("name","email"))
    .build();
Defensive patterns

Strategy: validation

Validate before calling

if (options.columnDelimiter() != null && options.headerColumns() == null) {
  throw new IllegalArgumentException("headerColumns is required when columnDelimiter is set");
}

Prevention

When it happens

Trigger: Calling DLPReidentifyText.newBuilder().setColumnDelimiter(",").build() without calling setHeaderColumns(...).

Common situations: Users copying a snippet that sets the delimiter but dropping the header list, or config where the delimiter is always set while headers are optional and absent.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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