alibaba/DataX · error · RuntimeException
dx_digest paras index 1 must be md5 or sha1
Error message
dx_digest paras index 1 must be md5 or sha1
What it means
The dx_digest transformer's second parameter (index 1) must be 'md5' or 'sha1' (case-insensitive); anything else throws RuntimeException and is rewrapped as TRANSFORMER_ILLEGAL_PARAMETER. This parameter selects the hash algorithm applied to the column's string value.
Source
Thrown at core/src/main/java/com/alibaba/datax/core/transport/transformer/DigestTransformer.java:48
@Override
public Record evaluate(Record record, Object... paras) {
int columnIndex;
String type;
String charType;
try {
if (paras.length != 3) {
throw new RuntimeException("dx_digest paras length must be 3");
}
columnIndex = (Integer) paras[0];
type = (String) paras[1];
charType = (String) paras[2];
if (!StringUtils.equalsIgnoreCase(MD5, type) && !StringUtils.equalsIgnoreCase(SHA1, type)) {
throw new RuntimeException("dx_digest paras index 1 must be md5 or sha1");
}
if (!StringUtils.equalsIgnoreCase(TO_UPPER_CASE, charType) && !StringUtils.equalsIgnoreCase(TO_LOWER_CASE, charType)) {
throw new RuntimeException("dx_digest paras index 2 must be toUpperCase or toLowerCase");
}
} catch (Exception e) {
throw DataXException.asDataXException(TransformerErrorCode.TRANSFORMER_ILLEGAL_PARAMETER, "paras:" + Arrays.asList(paras) + " => " + e.getMessage());
}
Column column = record.getColumn(columnIndex);
try {
String oriValue = column.asString();
// 如果字段为空,作为空字符串处理
if (oriValue == null) {
oriValue = "";
}
String newValue;View on GitHub (pinned to 80ec23d5c5)
Solutions
- Use exactly "md5" or "sha1" (any letter case, no surrounding whitespace).
- If sha256 is required, implement a custom transformer extending ComplexTransformer rather than hacking dx_digest.
- Trim parameters when generating the job JSON programmatically.
Example fix
// before
{"name": "dx_digest", "parameter": [0, "sha256", "toUpperCase"]}
// after
{"name": "dx_digest", "parameter": [0, "sha1", "toUpperCase"]} Defensive patterns
Strategy: validation
Validate before calling
String type = (String) paras[1];
if (!"md5".equalsIgnoreCase(type) && !"sha1".equalsIgnoreCase(type)) {
throw new IllegalArgumentException("dx_digest type must be md5|sha1, got: " + type);
} Prevention
- Whitelist md5/sha1 in job generation code.
- For sha256+, write a custom ComplexTransformer instead.
When it happens
Trigger: Passing e.g. "sha256", "MD5 " (trailing space), or a typo like "md6" as paras[1]: {"name":"dx_digest","parameter":[0,"sha256","toUpperCase"]}.
Common situations: Trying to use hash algorithms DataX has not implemented (sha256/sha512); whitespace/case-safe but spell-unsafe copy-paste edits.
Related errors
- dx_digest paras length must be 3
- dx_digest paras index 2 must be toUpperCase or toLowerCase
- dx_filter paras must be 3
- dx_filter para 2 can't be null
- dx_pad paras must be 4
AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14).
Data as JSON: /api/errors/95d1e9a25fb81745.
Report an issue: GitHub.