apache/beam · error · IllegalArgumentException

Column delimiter should be set if headers are present.

Error message

Column delimiter should be set if headers are present.

What it means

DLPReidentifyText.Builder.build() requires columnDelimiter to be set whenever headerColumns is supplied, because the transform uses the delimiter to reconstruct headers into the reidentified table output. Supplying headers without a delimiter would make table serialization ambiguous, so build() throws IllegalArgumentException.

Source

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

    abstract DLPReidentifyText autoBuild();

    public DLPReidentifyText build() {
      DLPReidentifyText dlpReidentifyText = autoBuild();
      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.

View on GitHub (pinned to 12126d8942)

Solutions

  1. Add .setColumnDelimiter(",") (or the delimiter your data actually uses) when setting headerColumns.
  2. If headers aren't needed, remove setHeaderColumns(...) instead.
  3. Ensure both headerColumns and columnDelimiter are set together from your config/PIPOptions.

Example fix

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

Strategy: validation

Validate before calling

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

Prevention

When it happens

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

Common situations: Users providing table headers for CSV-like data but forgetting the matching delimiter argument, or refactoring code that moved the delimiter setting into a conditional branch that doesn't fire.

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/574a35735700d405. Report an issue: GitHub.