pentaho/pentaho-kettle · error · RuntimeException
The function call floor requires 1 argument.
Error message
The function call floor requires 1 argument.
What it means
ScriptAddedFunctions implements the JavaScript (Rhino/Nashorn) utility functions available in the Script step (e.g. floor()). When floor() is invoked from script code, it requires exactly one argument (the value to round down). If ArgList.length != 1, the function throws this RuntimeException instead of silently returning a wrong result.
Solutions
- Pass exactly one argument: floor(value).
- Check the script for accidental extra arguments or a missing argument after refactor.
- If you need to round several values, call floor once per value.
Example fix
// before var x = floor(val, 0); // after var x = floor(val);
Defensive patterns
Strategy: validation
Validate before calling
if (typeof val === 'number') { var x = floor(val); } Type guard
function isNum(v) { return typeof v === 'number' && !isNaN(v); } Try / catch
try { var x = floor(val); } catch (e) { if (/floor requires 1 argument/.test(String(e))) { /* fix call site */ } else { throw e; } } Prevention
- Always call floor with exactly one numeric argument.
- Review script changes for altered function signatures.
- Keep a reference of Script step helper signatures handy.
When it happens
Trigger: Calling floor() in a Script step with zero arguments or more than one argument, e.g. floor() or floor(a, b).
Common situations: Copy-pasted script code edited by hand; calling floor with a comma-separated list thinking it takes multiple values; extra context arguments passed by mistake.
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 dateDiff requires 3 arguments.
- The function call fireToDB requires 2 arguments.
- The function call getDayNumber requires 2 arguments.
- The function call getEnvironmentVar requires 1 argument.
- The function call isWorkingDay requires 1 argument.
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/3db68c85267215e9.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:414
}
public static Object floor( 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.floor( (Double) ArgList[0] ) );
}
} catch ( Exception e ) {
return null;
// throw new RuntimeException(e.toString());
}
} else {
throw new RuntimeException( "The function call floor requires 1 argument." );
}
}
public static Object getDayNumber( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,
Object FunctionContext ) {
if ( ArgList.length == 2 ) {
try {
if ( isNull( ArgList[0] ) ) {
return new Double( Double.NaN );
} else if ( isUndefined( ArgList[0] ) ) {
return undefinedValue;
} else {
java.util.Date dIn = (java.util.Date) ArgList[0];
String strType = ( (String) ArgList[1] ).toLowerCase();
Calendar startDate = Calendar.getInstance();
startDate.setTime( dIn );
if ( strType.equals( "y" ) ) {
return new Double( startDate.get( Calendar.DAY_OF_YEAR ) );View on GitHub (pinned to f3058517a1)