alibaba/DataX · error · RuntimeException
dx_pad first para(%s) support l or r
Error message
dx_pad first para(%s) support l or r
What it means
Thrown by the dx_pad transformer when its first parameter (padType) is neither 'l' nor 'r' (case-insensitive). dx_pad pads or truncates a string column to a fixed length, aligning left ('l') or right ('r') with a pad string. Any other value for the first parameter is rejected before padding is attempted, and the original RuntimeException is rewrapped as TRANSFORMER_RUN_EXCEPTION by the surrounding catch.
Source
Thrown at core/src/main/java/com/alibaba/datax/core/transport/transformer/PadTransformer.java:52
padType = (String) paras[1];
length = Integer.valueOf((String) paras[2]);
padString = (String) paras[3];
} catch (Exception e) {
throw DataXException.asDataXException(TransformerErrorCode.TRANSFORMER_ILLEGAL_PARAMETER, "paras:" + Arrays.asList(paras).toString() + " => " + e.getMessage());
}
Column column = record.getColumn(columnIndex);
try {
String oriValue = column.asString();
//如果字段为空,作为空字符串处理
if(oriValue==null){
oriValue = "";
}
String newValue;
if (!padType.equalsIgnoreCase("r") && !padType.equalsIgnoreCase("l")) {
throw new RuntimeException(String.format("dx_pad first para(%s) support l or r", padType));
}
if (length <= oriValue.length()) {
newValue = oriValue.substring(0, length);
} else {
newValue = doPad(padType, oriValue, length, padString);
}
record.setColumn(columnIndex, new StringColumn(newValue));
} catch (Exception e) {
throw DataXException.asDataXException(TransformerErrorCode.TRANSFORMER_RUN_EXCEPTION, e.getMessage(),e);
}
return record;
}
private String doPad(String padType, String oriValue, int length, String padString) {
View on GitHub (pinned to 80ec23d5c5)
Solutions
- Set the first element of the transformer's paras array to exactly "l" or "r" (e.g. "paras": ["r", "10", "0"]) in the job JSON.
- Check for stray whitespace or quotes around the value in the job configuration file.
- Confirm the transformer parameter order: padType first, then length, then pad string.
- Re-run the job and verify the padded output on a few sample rows.
Example fix
// before (job JSON)
"transformer": [{ "name": "dx_pad", "parameter": { "columnIndex": 2, "paras": ["right", "10", "0"] } }]
// after
"transformer": [{ "name": "dx_pad", "parameter": { "columnIndex": 2, "paras": ["r", "10", "0"] } }] Defensive patterns
Strategy: validation
Validate before calling
// job config lint before submit
JSONObject t = transformer;
String padType = (String) t.getJSONArray("paras").getString(0);
if (!"l".equalsIgnoreCase(padType) && !"r".equalsIgnoreCase(padType))
throw new IllegalArgumentException("dx_pad paras[0] must be 'l' or 'r', got: " + padType); Prevention
- Validate transformer parameter shape in a job-config preflight script before submitting to DataX.
- Keep a reviewed library of known-good transformer parameter blocks and copy from there only.
When it happens
Trigger: A job JSON uses the dx_pad transformer with a paras array whose first element is not exactly 'l', 'L', 'r', or 'R', e.g. "paras": ["left", "10", "*"] or "paras": ["R ", ...]. The check runs on every record, so the job fails on the first record of the first column the transformer touches.
Common situations: Copying a pad example from another tool that uses 'left'/'right', trailing whitespace in the parameter string, or a typo such as 'L,' or uppercase-mixed values with invisible characters. Note paras[0] here is compared as a String, unlike some transformers where it is an integer column index.
Related errors
- dx_pad paras must be 4
- TRANSFORMER_ILLEGAL_PARAMETER
- TRANSFORMER_ILLEGAL_PARAMETER
- 您提供的配置文件有误. 路径[%s]需要配置Json格式的Map对象,但该节点发现实际类型是[%s]. 请检查您的配置并
- 您提供的配置文件有误. 路径[%s]值为null,datax无法识别该配置. 请检查您的配置并作出修改.
AI-assisted analysis of alibaba/DataX@80ec23d5c5 (2026-08-14).
Data as JSON: /api/errors/949419afc72c1b32.
Report an issue: GitHub.