{"record":{"id":"574a35735700d405","repo":"apache/beam","slug":"column-delimiter-should-be-set-if-headers-are-present-574a35","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/DLPReidentifyText.java","lineNumber":179,"sourceCode":"\n    abstract DLPReidentifyText autoBuild();\n\n    public DLPReidentifyText build() {\n      DLPReidentifyText dlpReidentifyText = autoBuild();\n      if (dlpReidentifyText.getReidentifyConfig() == null\n          && dlpReidentifyText.getReidentifyTemplateName() == null) {\n        throw new IllegalArgumentException(\n            \"Either reidentifyConfig or reidentifyTemplateName need to be set!\");\n      }\n      if (dlpReidentifyText.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 (dlpReidentifyText.getColumnDelimiter() == null\n          && dlpReidentifyText.getHeaderColumns() != null) {\n        throw new IllegalArgumentException(\n            \"Column delimiter should be set if headers are present.\");\n      }\n      if (dlpReidentifyText.getHeaderColumns() == null\n          && dlpReidentifyText.getColumnDelimiter() != null) {\n        throw new IllegalArgumentException(\n            \"Column headers should be supplied when delimiter is present.\");\n      }\n      return dlpReidentifyText;\n    }\n  }\n\n  public static DLPReidentifyText.Builder newBuilder() {\n    return new AutoValue_DLPReidentifyText.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 reidentification according to provided settings.","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/ml/src/main/java/org/apache/beam/sdk/extensions/ml/DLPReidentifyText.java#L161-L197","documentation":"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.","triggerScenarios":"Calling DLPReidentifyText.newBuilder().setHeaderColumns(...).build() without calling setColumnDelimiter(...).","commonSituations":"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.","solutions":["Add .setColumnDelimiter(\",\") (or the delimiter your data actually uses) when setting headerColumns.","If headers aren't needed, remove setHeaderColumns(...) instead.","Ensure both headerColumns and columnDelimiter are set together from your config/PIPOptions."],"exampleFix":"// before\nDLPReidentifyText.newBuilder().setHeaderColumns(ImmutableList.of(\"name\",\"email\")).build();\n// after\nDLPReidentifyText.newBuilder()\n    .setHeaderColumns(ImmutableList.of(\"name\",\"email\"))\n    .setColumnDelimiter(\",\")\n    .build();","handlingStrategy":"validation","validationCode":"if (options.headerColumns() != null && options.columnDelimiter() == null) {\n  throw new IllegalArgumentException(\"columnDelimiter is required when headerColumns is set\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set headerColumns and columnDelimiter together in a shared helper.","Group the two fields in one config object so they can't diverge.","Add a builder smoke test that builds with headers set."],"tags":["java","apache-beam","dlp","validation","configuration"],"backgroundTag":"missing-required-argument","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}