apache/seatunnel · error · IllegalArgumentException
Invalid argument , should have 2 parts
Error message
Invalid argument , should have 2 parts
What it means
SchemaUtils.transformArgPair parses the comma-separated argument list inside a parameterized partition transform like bucket[16,id] or truncate[10,name]. It requires exactly two parts: column name and width. If the split doesn't yield exactly two parts, it throws IllegalArgumentException 'Invalid argument <argsStr>, should have 2 parts'.
Source
Thrown at seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/utils/SchemaUtils.java:377
Pair<String, Integer> args = transformArgPair(matcher.group(2));
specBuilder.truncate(args.first(), args.second());
break;
}
default:
throw new UnsupportedOperationException(
"Unsupported transform: " + transform);
}
} else {
specBuilder.identity(partitionField);
}
});
return specBuilder.build();
}
private static Pair<String, Integer> transformArgPair(String argsStr) {
String[] parts = argsStr.split(",");
if (parts.length != 2) {
throw new IllegalArgumentException(
"Invalid argument " + argsStr + ", should have 2 parts");
}
return Pair.of(parts[0].trim(), Integer.parseInt(parts[1].trim()));
}
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Format parameterized transforms as transform[width,column], e.g. bucket[16,id] or truncate[10,name]
- Count the comma-separated parts in the bracketed argument string — must be exactly 2
- Check for stray/missing commas in the partition config
- If using identity or simple temporal transforms, drop the bracketed argument entirely instead
Example fix
// before
partition = { transform = "bucket[16]" }
// after
partition = { transform = "bucket[16,id]" } Defensive patterns
Strategy: validation
Validate before calling
String inner = transformStr.substring(transformStr.indexOf('[') + 1, transformStr.indexOf(']'));
String[] parts = inner.split(",");
if (parts.length != 2) {
throw new IllegalArgumentException("Transform args must be [width,column]: " + inner);
} Try / catch
try {
Pair<String,Integer> arg = SchemaUtils.transformArgPair(argsStr);
} catch (IllegalArgumentException e) {
log.error("Bad partition transform args '{}': use e.g. bucket[16,id]", argsStr);
throw e;
} Prevention
- Always include both width and column inside the brackets: bucket[16,col]
- Do not use engine-specific syntax like bucket[16](col)
- Count commas before saving partition config
- Cover transform parsing with unit tests using representative config strings
When it happens
Trigger: A transform argument string with the wrong number of comma-separated parts, e.g. 'bucket[16]' argument portion '16' (one part) or 'bucket[16,col,extra]' (three parts) passed into SchemaUtils while building the partition spec.
Common situations: Users writing Iceberg-style 'bucket[16](col)' syntax where the connector expects 'bucket[16,col]'; missing column name; stray commas from copy-paste; omitting the column in the bracketed argument.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Unsupported transform:
- Table name is empty
- UNSUPPORTED_OPERATION
- Error adding Hadoop resource {}, resource was not added
- Principal [{}] or keytabPath [{}] is empty, it will skip ker
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/b28ecb8d7a239690.
Report an issue: GitHub.