pentaho/pentaho-kettle · error · RuntimeException
The function call isWorkingDay requires 1 argument.
Error message
The function call isWorkingDay requires 1 argument.
What it means
isWorkingDay(date) checks whether a given date falls on a working day. It requires exactly one argument; any other argument count throws this RuntimeException. On internal evaluation errors it returns null instead of throwing, so this message only appears for wrong arity.
Solutions
- Pass exactly one Date argument: isWorkingDay(myDate).
- Ensure the argument is a Date object (parse strings to Date first).
- Use nextWorkingDay/dateDiff helpers only with their documented signatures.
Example fix
// before
var wd = isWorkingDay('2026-01-05');
// after
var wd = isWorkingDay(new Date('2026/01/05')); Defensive patterns
Strategy: type-guard
Validate before calling
if (myDate instanceof Date) { var wd = isWorkingDay(myDate); } Type guard
function isDate(v) { return v instanceof Date && !isNaN(v.getTime()); } Try / catch
try { var wd = isWorkingDay(myDate); } catch (e) { if (/isWorkingDay requires 1 argument/.test(String(e))) { wd = null; } else { throw e; } } Prevention
- Pass exactly one Date object.
- Handle null upstream fields before the script step.
- Avoid wrapping extra context values into the call.
When it happens
Trigger: Calling isWorkingDay() with zero arguments or two or more arguments from script code in a Script step.
Common situations: Passing both a date and a format string; forgetting the argument entirely; converting code that used a different helper with multiple parameters.
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 floor requires 1 argument.
- The function call getDayNumber requires 2 arguments.
- The function call getEnvironmentVar requires 1 argument.
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/950ad0192635c9d1.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:473
if ( isNull( ArgList[0] ) ) {
return null;
} else if ( isUndefined( ArgList[0] ) ) {
return undefinedValue;
} else {
java.util.Date dIn = (java.util.Date) ArgList[0];
Calendar startDate = Calendar.getInstance();
startDate.setTime( dIn );
if ( startDate.get( Calendar.DAY_OF_WEEK ) != Calendar.SATURDAY
&& startDate.get( Calendar.DAY_OF_WEEK ) != Calendar.SUNDAY ) {
return Boolean.TRUE;
}
return Boolean.FALSE;
}
} catch ( Exception e ) {
return null;
}
} else {
throw new RuntimeException( "The function call isWorkingDay requires 1 argument." );
}
}
@SuppressWarnings( "unused" )
public static Object fireToDB( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,
Object FunctionContext ) {
Object oRC = new Object();
if ( ArgList.length == 2 ) {
try {
Object scmO = actualObject.get( "_step_" );
Script scm = (Script) scmO;
String strDBName = (String) ArgList[0];
String strSQL = (String) ArgList[1];
DatabaseMeta ci = DatabaseMeta.findDatabase( scm.getTransMeta().getDatabases(), strDBName );
if ( ci == null ) {
throw new RuntimeException( "Database connection not found: " + strDBName );
}View on GitHub (pinned to f3058517a1)