{"record":{"id":"37146c18ffaf86e5","repo":"apache/beam","slug":"column-headers-should-be-supplied-when-delimiter-is-present-37146c","errorCode":null,"errorMessage":"Column headers should be supplied when delimiter is present.","messagePattern":"Column headers should be supplied when delimiter is 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":184,"sourceCode":"      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.\n   *\n   * @param input input PCollection\n   * @return PCollection after transformations\n   */\n  @Override","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/ml/src/main/java/org/apache/beam/sdk/extensions/ml/DLPReidentifyText.java#L166-L202","documentation":"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.","triggerScenarios":"Calling DLPReidentifyText.newBuilder().setColumnDelimiter(\",\").build() without calling setHeaderColumns(...).","commonSituations":"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.","solutions":["Add .setHeaderColumns(...) listing the table's column names when setting a columnDelimiter.","If headers are unnecessary, remove setColumnDelimiter(...) so neither is set.","Validate your options object so delimiter and headers are always provided as a pair."],"exampleFix":"// before\nDLPReidentifyText.newBuilder().setColumnDelimiter(\",\").build();\n// after\nDLPReidentifyText.newBuilder()\n    .setColumnDelimiter(\",\")\n    .setHeaderColumns(ImmutableList.of(\"name\",\"email\"))\n    .build();","handlingStrategy":"validation","validationCode":"if (options.columnDelimiter() != null && options.headerColumns() == null) {\n  throw new IllegalArgumentException(\"headerColumns is required when columnDelimiter is set\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat delimiter+headers as a single logical option; set or omit both.","Validate your pipeline options before constructing the transform.","Prefer building the transform via a wrapper that enforces the pairing."],"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"}