pentaho/pentaho-kettle · error · RuntimeException
The function call abs requires 1 argument.
Error message
The function call abs requires 1 argument.
What it means
The added abs function takes exactly 1 numeric argument and returns its absolute value as a Double. Wrong argument count throws RuntimeException; a non-numeric value inside the correct arity is swallowed and returns null.
Solutions
- Call abs with exactly one numeric argument
- Ensure the argument is a Number (cast/parse in JS) to avoid null return
- Wrap in try/catch for dynamic arity
Example fix
// before var v = abs(x, 0); // after var v = abs(x);
Defensive patterns
Strategy: validation
Validate before calling
// JS in Script step
if (arguments.length !== 1 || typeof arguments[0] !== 'number') {
throw new Error('abs expects exactly one numeric argument');
}
var v = abs(x); Type guard
// JS
function isSingleNumber(args) {
return args.length === 1 && typeof args[0] === 'number' && !isNaN(args[0]);
} Try / catch
try {
var v = abs(x);
if (v === null) { /* non-numeric input case */ }
} catch (e) {
Logger.logError('abs failed: ' + e.message);
v = null;
} Prevention
- Parse strings to numbers before calling abs
- Remember null (not an exception) signals bad input within correct arity
- Avoid passing extra sentinel arguments
When it happens
Trigger: Calling abs() with no arguments or abs(x, y) with two arguments in a Script step.
Common situations: Confusing with Math.abs usage patterns; expecting multiple-value support; generated scripts emitting extra arguments.
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 appendToFile requires arguments.
- The function call getDigitsOnly requires 1 argument.
- The function call getFiscalDate requires 2 arguments.
- The function call getProcessCount requires 1 argument.
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/6f25086e8f899e6d.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:375
}
public static Object abs( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,
Object FunctionContext ) {
if ( ArgList.length == 1 ) {
try {
if ( isNull( ArgList[0] ) ) {
return new Double( Double.NaN );
} else if ( isUndefined( ArgList[0] ) ) {
return undefinedValue;
} else {
return new Double( Math.abs( (Double) ArgList[0] ) );
}
} catch ( Exception e ) {
return null;
}
} else {
throw new RuntimeException( "The function call abs requires 1 argument." );
}
}
public static Object ceil( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,
Object FunctionContext ) {
if ( ArgList.length == 1 ) {
try {
if ( isNull( ArgList[0] ) ) {
return new Double( Double.NaN );
} else if ( isUndefined( ArgList[0] ) ) {
return undefinedValue;
} else {
return new Double( Math.ceil( (Double) ArgList[0] ) );
}
} catch ( Exception e ) {
return null;
}
} else {View on GitHub (pinned to f3058517a1)