pentaho/pentaho-kettle · error · Rhino runtime error
The function call removeDigits requires 1 argument.
Error message
The function call removeDigits requires 1 argument.
What it means
removeDigits strips digit characters from a string via Const.removeDigits in the Modified Java Script Value step. The wrapper throws this Rhino runtime error whenever the function is called with anything other than exactly one argument.
Solutions
- Call removeDigits with exactly one argument: removeDigits(inputString)
- If custom digit filtering is needed, use str.replace(/\d/g,'') directly in the script
- Validate the field variable is defined before passing it
Example fix
// before var cleaned = removeDigits(value, "/d"); // after var cleaned = removeDigits(value);
Defensive patterns
Strategy: validation
Validate before calling
if (typeof value === 'string') { var cleaned = removeDigits(value); } Type guard
function isString(v){ return typeof v === 'string'; } Try / catch
try { var cleaned = removeDigits(value); } catch (e) { throw new Error('removeDigits requires exactly 1 argument: ' + e.message); } Prevention
- Use inline regex for custom filtering instead of extra args
- Ensure argument variables are defined at runtime
- Test with representative rows before running the transformation
When it happens
Trigger: removeDigits() with no argument, or removeDigits(s, x) with extra arguments; the length==1 check fails and Context.reportRuntimeError fires.
Common situations: Users adding a second argument expecting a regex mode; argument variable left undefined after renaming a field, producing a zero-arg call.
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 initCap requires 1 argument.
- 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 date2str requires 1, 2, 3, or 4 arguments.
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/c210fa384a5a1cb9.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:2770
}
}
public static String protectXMLCDATA( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function FunctionContext ) {
if ( ArgList.length == 1 ) {
return Const.protectXMLCDATA( Context.toString( ArgList[0] ) );
} else {
throw Context.reportRuntimeError( "The function call protectXMLCDATA requires 1 argument." );
}
}
public static String removeDigits( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function FunctionContext ) {
if ( ArgList.length == 1 ) {
return Const.removeDigits( Context.toString( ArgList[0] ) );
} else {
throw Context.reportRuntimeError( "The function call removeDigits requires 1 argument." );
}
}
public static String initCap( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function FunctionContext ) {
if ( ArgList.length == 1 ) {
return Const.initCap( Context.toString( ArgList[0] ) );
} else {
throw Context.reportRuntimeError( "The function call initCap requires 1 argument." );
}
}
public static Object loadFileContent( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function FunctionContext ) {
Object oRC = new Object();
try {View on GitHub (pinned to f3058517a1)