pentaho/pentaho-kettle · error
The function call fillString requires 2 arguments.
Error message
The function call fillString requires 2 arguments.
What it means
Arity guard for fillString: the function builds a repeated-character string from exactly two arguments (fill char, count). With any other count the else-branch throws; note the fill char must also be exactly one character long or a separate error is raised.
Solutions
- Call with exactly two arguments: fillString(char, count)
- Verify the count argument is not accidentally embedded in the char argument
- Use a constant or field value for the count and confirm it is defined
Example fix
// before
var pad = fillString('0');
// after
var pad = fillString('0', 8); Defensive patterns
Strategy: validation
Validate before calling
if (arguments.length !== 2) throw new Error('fillString(char, count) requires 2 arguments'); Try / catch
try { var s = fillString(ch, n); } catch (e) { if (String(e).indexOf('requires 2 arguments') >= 0) { /* correct call */ } } Prevention
- Count arguments before calling: char + count = exactly 2
- Do not merge the count into the char string
- Define defaults (e.g. n = n || 0) outside the call
When it happens
Trigger: Calling fillString('-') (missing count), fillString() or fillString('-', 10, 'x') (extra arg).
Common situations: Forgetting the length parameter when building padding; confusing fillString with padLeft/padRight signatures used in other libraries.
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 ltrim requires 1 argument.
- The function call rtrim requires 1 argument.
- Please provide a valid Char to the fillString
- The function call dateAdd requires 3 arguments.
- The function call dateDiff requires 3 arguments.
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/5b60d106100f084f.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:739
} else if ( isUndefined( ArgList, new int[] { 0, 1 } ) ) {
return (String) Context.getUndefinedValue();
}
String fillChar = Context.toString( ArgList[0] );
int count = (int) Context.toNumber( ArgList[1] );
if ( fillChar.length() != 1 ) {
throw Context.reportRuntimeError( "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 Context.reportRuntimeError( e.toString() );
}
} else {
throw Context.reportRuntimeError( "The function call fillString requires 2 arguments." );
}
}
public static Object isCodepage( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function 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 Context.getUndefinedValue();
}
String strValueToCheck = Context.toString( ArgList[0] );
String strCodePage = Context.toString( 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)