alibaba/DataX · error · RuntimeException

dx_digest paras index 2 must be toUpperCase or toLowerCase

Error message

dx_digest paras index 2 must be toUpperCase or toLowerCase

What it means

The dx_digest transformer's third parameter (index 2) must be 'toUpperCase' or 'toLowerCase' (case-insensitive); other values throw RuntimeException rewrapped as TRANSFORMER_ILLEGAL_PARAMETER. It controls the letter case of the resulting hex digest string.

Source

Thrown at core/src/main/java/com/alibaba/datax/core/transport/transformer/DigestTransformer.java:51

        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;
            if (MD5.equals(type)) {
                newValue = DigestUtils.md5Hex(oriValue);
            } else {

View on GitHub (pinned to 80ec23d5c5)

Solutions

  1. Use exactly "toUpperCase" or "toLowerCase".
  2. Add a validation step in job-generation scripts that whitelists the third parameter.

Example fix

// before
{"name": "dx_digest", "parameter": [0, "md5", "upper"]}

// after
{"name": "dx_digest", "parameter": [0, "md5", "toUpperCase"]}
Defensive patterns

Strategy: validation

Validate before calling

String c = (String) paras[2];
if (!"toUpperCase".equalsIgnoreCase(c) && !"toLowerCase".equalsIgnoreCase(c)) {
    throw new IllegalArgumentException("dx_digest case must be toUpperCase|toLowerCase, got: " + c);
}

Prevention

When it happens

Trigger: Passing e.g. "upper", "none", or omitting-but-padding with an arbitrary string as paras[2]: {"name":"dx_digest","parameter":[0,"md5","none"]}.

Common situations: Users assume 'none'/'raw' is valid to keep original case; abbreviation typos like "upper" instead of "toUpperCase".

Related errors


AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14). Data as JSON: /api/errors/7d3f017aa3f4cbff. Report an issue: GitHub.