pentaho/pentaho-kettle · error · RuntimeException
The function call fillString requires 2 arguments.
Error message
The function call fillString requires 2 arguments.
What it means
fillString requires exactly two arguments: the single fill character and the repeat count. When ArgList.length != 2 it throws this RuntimeException from the else branch. This check runs before any value validation.
Solutions
- Call with exactly two arguments: fillString(char, count).
- Add the missing count argument.
- Note the argument order is (char, count), not (count, char).
Example fix
// before
var pad = fillString(20);
// after
var pad = fillString(' ', 20); Defensive patterns
Strategy: validation
Validate before calling
if (arguments.length !== 2) {
throw new Error('fillString requires exactly 2 arguments: (char, count)');
}
var padded = fillString(fillChar, count); Type guard
function isFillStringCall(c, n) { return typeof c === 'string' && c.length === 1 && typeof n === 'number'; } Try / catch
try {
var padded = fillString(fillChar, count);
} catch (e) {
if (String(e.message).indexOf('requires 2 arguments') !== -1) {
throw new Error('Call fillString as fillString(char, count)');
} else { throw e; }
} Prevention
- Argument order is (char, count), not (count, char).
- Always supply both arguments explicitly.
- Avoid porting padding calls from other libraries without checking this signature.
When it happens
Trigger: Calling fillString('-') (missing count) or fillString('-', 10, 'x') (extra argument).
Common situations: Forgetting the count and expecting a default; porting code from other padding libraries that take (length, char) in the opposite order and dropping one 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 date2str requires 1, 2, 3, or 4 arguments.
- The function call dateAdd requires 3 arguments.
- The function call escapeHtml requires 1 argument.
- The function call escapeSQL requires 1 argument.
- The function call escapeXml requires 1 argument.
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/03732bf7edf9bc9f.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:709
} else if ( isUndefined( ArgList, new int[] { 0, 1 } ) ) {
return (String) undefinedValue;
}
String fillChar = (String) ArgList[0];
int count = (Integer) ArgList[1];
if ( fillChar.length() != 1 ) {
throw new RuntimeException( "Please provide a valid Char to the fillString" );
} else {
char[] chars = new char[count];
while ( count > 0 ) {
chars[--count] = fillChar.charAt( 0 );
}
return new String( chars );
}
} catch ( Exception e ) {
throw new RuntimeException( e.toString() );
}
} else {
throw new RuntimeException( "The function call fillString requires 2 arguments." );
}
}
public static Object isCodepage( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,
Object FunctionContext ) {
boolean bRC = false;
if ( ArgList.length == 2 ) {
try {
if ( isNull( ArgList, new int[] { 0, 1 } ) ) {
return null;
} else if ( isUndefined( ArgList, new int[] { 0, 1 } ) ) {
return undefinedValue;
}
String strValueToCheck = (String) ArgList[0];
String strCodePage = (String) ArgList[1];
byte[] bytearray = strValueToCheck.getBytes();
CharsetDecoder d = Charset.forName( strCodePage ).newDecoder();
CharBuffer r = d.decode( ByteBuffer.wrap( bytearray ) );View on GitHub (pinned to f3058517a1)