{"record":{"id":"44ff8f3de2d84127","repo":"apache/beam","slug":"column-delimiter-should-be-set-if-headers-are-present","errorCode":null,"errorMessage":"Column delimiter should be set if headers are present.","messagePattern":"Column delimiter should be set if headers are present\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/ml/src/main/java/org/apache/beam/sdk/extensions/ml/DLPDeidentifyText.java","lineNumber":174,"sourceCode":"\n    abstract DLPDeidentifyText autoBuild();\n\n    public DLPDeidentifyText build() {\n      DLPDeidentifyText dlpDeidentifyText = autoBuild();\n      if (dlpDeidentifyText.getDeidentifyConfig() == null\n          && dlpDeidentifyText.getDeidentifyTemplateName() == null) {\n        throw new IllegalArgumentException(\n            \"Either deidentifyConfig or deidentifyTemplateName need to be set!\");\n      }\n      if (dlpDeidentifyText.getBatchSizeBytes() > DLP_PAYLOAD_LIMIT_BYTES) {\n        throw new IllegalArgumentException(\n            String.format(\n                \"Batch size is too large! It should be smaller or equal than %d.\",\n                DLP_PAYLOAD_LIMIT_BYTES));\n      }\n      if (dlpDeidentifyText.getColumnDelimiter() == null\n          && dlpDeidentifyText.getHeaderColumns() != null) {\n        throw new IllegalArgumentException(\n            \"Column delimiter should be set if headers are present.\");\n      }\n      if (dlpDeidentifyText.getHeaderColumns() == null\n          && dlpDeidentifyText.getColumnDelimiter() != null) {\n        throw new IllegalArgumentException(\n            \"Column headers should be supplied when delimiter is present.\");\n      }\n      return dlpDeidentifyText;\n    }\n  }\n\n  public static DLPDeidentifyText.Builder newBuilder() {\n    return new AutoValue_DLPDeidentifyText.Builder();\n  }\n\n  /**\n   * The transform converts the contents of input PCollection into {@link Table.Row}s and then calls\n   * Cloud DLP service to perform the deidentification according to provided settings.","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/ml/src/main/java/org/apache/beam/sdk/extensions/ml/DLPDeidentifyText.java#L156-L192","documentation":"DLPDeidentifyText.Builder.build validates paired CSV-style options: if headerColumns are supplied but columnDelimiter is not, the delimiter needed to parse/handle the table is missing, so build throws IllegalArgumentException.","triggerScenarios":"Calling .setHeaderColumns(...) without calling .setColumnDelimiter(...) before build().","commonSituations":"Partially porting configuration from another transform; assuming a default delimiter is applied when headers are set; incremental edits to builder code.","solutions":["Add .setColumnDelimiter(\",\") (or the delimiter your data uses) alongside setHeaderColumns.","Or remove setHeaderColumns if the data is not columnar.","Default the delimiter in pipeline options when headers are provided."],"exampleFix":"// before\n.setHeaderColumns(ImmutableList.of(\"name\",\"ssn\"))\n.build();\n// after\n.setHeaderColumns(ImmutableList.of(\"name\",\"ssn\"))\n.setColumnDelimiter(\",\")\n.build();","handlingStrategy":"validation","validationCode":"if (headerColumns != null && columnDelimiter == null) throw new IllegalArgumentException(\"columnDelimiter required with headerColumns\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set headerColumns and columnDelimiter as a pair","Centralize DLP options building in one validated helper"],"tags":["java","dlp","builder-validation","config"],"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"}