pentaho/pentaho-kettle · error
The function call abs requires 1 argument.
Error message
The function call abs requires 1 argument.
What it means
The abs() helper registered for the ScriptValuesMod step wraps Math.abs but requires exactly 1 numeric argument; calling it with zero arguments (or any count other than 1) throws this Rhino runtime error.
Solutions
- Call abs with exactly one numeric argument: abs(myNumber).
- Apply it per element if you have an array, not on the array itself.
- Ensure the argument expression yields a number (Context.toNumber is applied inside).
Example fix
// before var a = abs(); // after var a = abs(myValue);
Defensive patterns
Strategy: validation
Validate before calling
var n = +(myValue); if (isNaN(n)) n = 0; var a = abs(n);
Type guard
function isNumber(v){ return typeof v === 'number' && !isNaN(v); } Prevention
- Always supply one numeric argument.
- Coerce strings to numbers with +value before math helpers.
- Handle arrays element-wise rather than passing the array.
When it happens
Trigger: abs() with no arguments, or abs(a, b) with two, in a Modified Java Script Value step.
Common situations: Migrating from another scripting library where abs accepted a list or array; forgetting the argument when testing; passing an array expecting element-wise results.
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 ceil requires 1 argument.
- The function call floor requires 1 argument.
- The function call appendToFile requires arguments.
- The function call getDayNumber requires 2 arguments.
- The function call getFiscalDate requires 2 arguments.
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/e8ab00e27ecafd15.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:393
}
public static Object abs( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function FunctionContext ) {
if ( ArgList.length == 1 ) {
try {
if ( isNull( ArgList[0] ) ) {
return new Double( Double.NaN );
} else if ( isUndefined( ArgList[0] ) ) {
return Context.getUndefinedValue();
} else {
return new Double( Math.abs( Context.toNumber( ArgList[0] ) ) );
}
} catch ( Exception e ) {
return null;
}
} else {
throw Context.reportRuntimeError( "The function call abs requires 1 argument." );
}
}
public static Object ceil( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function FunctionContext ) {
if ( ArgList.length == 1 ) {
try {
if ( isNull( ArgList[0] ) ) {
return Double.NaN;
} else if ( isUndefined( ArgList[0] ) ) {
return Context.getUndefinedValue();
} else {
return Math.ceil( Context.toNumber( ArgList[ 0 ] ) );
}
} catch ( Exception e ) {
return null;
}
} else {View on GitHub (pinned to f3058517a1)