apache/beam · error · IllegalArgumentException
Either reidentifyConfig or reidentifyTemplateName need to be
Error message
Either reidentifyConfig or reidentifyTemplateName need to be set!
What it means
DLPReidentifyText re-identifies previously de-identified text and needs to know how to perform the re-identification: either an inline ReidentifyConfig or the name of a stored re-identify template. Its builder's build() throws this IllegalArgumentException when both fields are null, since the DLP reidentify call would have no configuration.
Source
Thrown at sdks/java/extensions/ml/src/main/java/org/apache/beam/sdk/extensions/ml/DLPReidentifyText.java:168
*
* @param delimiter Delimiter to be used when splitting values from input strings into columns.
*/
public abstract Builder setColumnDelimiter(String delimiter);
/**
* Sets ID of Google Cloud project to be used when deidentifying data.
*
* @param projectId ID of Google Cloud project to be used when deidentifying data.
*/
public abstract Builder setProjectId(String projectId);
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.");
}View on GitHub (pinned to 12126d8942)
Solutions
- Call .setReidentifyTemplateName("projects/YOUR_PROJECT/locations/LOCATION/deidentifyTemplates/TEMPLATE_ID") pointing at a stored re-identify template.
- Or call .setReidentifyConfig(ReidentifyConfig.newBuilder()...build()) with an inline configuration.
- If constructing from config, check that at least one of the two keys exists before building the transform.
Example fix
// before
DLPReidentifyText reidentify = DLPReidentifyText.newBuilder()
.setProjectId("my-project")
.build(); // throws
// after
DLPReidentifyText reidentify = DLPReidentifyText.newBuilder()
.setProjectId("my-project")
.setReidentifyTemplateName("projects/my-project/locations/global/deidentifyTemplates/my-template")
.build(); Defensive patterns
Strategy: validation
Validate before calling
if (reidentifyTemplateName == null && reidentifyConfig == null) {
throw new IllegalArgumentException("Provide either reidentifyTemplateName or reidentifyConfig before building DLPReidentifyText");
} Try / catch
try {
DLPReidentifyText reidentify = DLPReidentifyText.newBuilder()...build();
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("reidentifyConfig or reidentifyTemplateName")) {
// supply a reidentify config/template and rebuild
}
} Prevention
- Always configure exactly one of reidentifyTemplateName or reidentifyConfig in a shared builder helper.
- Use a stored re-identify template referenced from central config.
- Cover transform construction in unit tests so missing config fails before a pipeline run.
When it happens
Trigger: Calling DLPReidentifyText.newBuilder()...build() without calling either .setReidentifyTemplateName(String) or .setReidentifyConfig(ReidentifyConfig).
Common situations: Copying pipeline code from DLPDeidentifyText/DLPInspectText and forgetting to add the reidentify-specific configuration, or config-driven builds where both optional properties were missing.
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
- Either inspectTemplateName or inspectConfig must be supplied
- Batch size is too large! It should be smaller or equal than
- Column delimiter should be set if headers are present.
- Column headers should be supplied when delimiter is present.
- Timing number 0b" + timingNumber.toString(2) + " has more th
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/52571e5ed9ee313b.
Report an issue: GitHub.