pentaho/pentaho-kettle · error · RuntimeException
The function call rpad requires 3 arguments.
Error message
The function call rpad requires 3 arguments.
What it means
rpad() right-pads a string to a target size with a filler string. Like lpad, it requires exactly three arguments; any missing argument or inner exception is converted to this RuntimeException and the function returns null.
Solutions
- Call rpad with exactly three arguments: rpad(value, size, filler).
- Ensure size is numeric and filler is a string.
- Guard against null values before calling rpad.
- Replace dynamic argument construction with a fixed three-argument call.
Example fix
// before var padded = rpad(name, 10); // after var padded = rpad(name, 10, " ");
Defensive patterns
Strategy: validation
Validate before calling
if (value != null && typeof size === "number" && size > 0) { var padded = rpad(value, size, filler); } Type guard
function canRpad(v, size, filler) { return v != null && typeof size === "number" && size > 0 && filler != null && String(filler).length > 0; } Try / catch
try {
var padded = rpad(value, size, filler);
if (padded === null) { /* argument-count failure path */ }
} catch (e) {
Logger.LogBasic("rpad failed: " + e.message);
padded = value;
} Prevention
- Pass exactly three arguments to rpad().
- Validate size numerically before the call.
- Use a non-empty string filler.
- Check for null return values, which signal the failure path.
When it happens
Trigger: Calling rpad(value) or rpad(value, size) in a Script step, or a three-argument call whose processing throws (bad size type, null value), which lands in the same catch.
Common situations: Porting two-argument RPAD usage from other languages; building the argument list dynamically and dropping the filler argument.
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
- The function call lpad requires 3 arguments.
- The function call month requires 1 argument.
- The function call quarter requires 1 argument.
- The function call rtrim is not valid :
- The function call week requires 1 argument.
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/253290609d3605db.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:822
Object FunctionContext ) {
try {
if ( ArgList.length == 3 ) {
if ( isNull( ArgList, new int[] { 0, 1, 2 } ) ) {
return null;
} else if ( isUndefined( ArgList, new int[] { 0, 1, 2 } ) ) {
return (String) undefinedValue;
}
String valueToPad = (String) ArgList[0];
String filler = (String) ArgList[1];
int size = (Integer) ArgList[2];
while ( valueToPad.length() < size ) {
valueToPad = valueToPad + filler;
}
return valueToPad;
}
} catch ( Exception e ) {
throw new RuntimeException( "The function call rpad requires 3 arguments." );
}
return null;
}
public static Object year( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,
Object FunctionContext ) {
try {
if ( ArgList.length == 1 ) {
if ( isNull( ArgList[0] ) ) {
return new Double( Double.NaN );
} else if ( isUndefined( ArgList[0] ) ) {
return undefinedValue;
}
java.util.Date dArg1 = (java.util.Date) ArgList[0];
Calendar cal = Calendar.getInstance();
cal.setTime( dArg1 );
return new Double( cal.get( Calendar.YEAR ) );
} else {View on GitHub (pinned to f3058517a1)