pentaho/pentaho-kettle · error
The function call getFiscalDate requires 2 arguments.
Error message
The function call getFiscalDate requires 2 arguments.
What it means
getFiscalDate computes a fiscal-calendar date by shifting a given date a number of days; the ScriptValuesMod step requires exactly 2 arguments (a Date and the day count). When ArgList.length != 2 it throws this Rhino runtime error.
Solutions
- Call getFiscalDate with exactly two arguments, e.g. getFiscalDate(new Date(), 30).
- Verify the second argument is a number of days, not a string.
- Check for typos merging two calls onto one line.
Example fix
// before var fiscal = getFiscalDate(orderDate); // after var fiscal = getFiscalDate(orderDate, 30);
Defensive patterns
Strategy: validation
Validate before calling
var d = orderDate instanceof Date ? orderDate : new Date(); var days = isNaN(+offset) ? 0 : +offset; var fiscal = getFiscalDate(d, days);
Type guard
function isDateArg(v){ return v instanceof Date && !isNaN(v.getTime()); } Prevention
- Pass exactly two arguments: a Date and a numeric day count.
- Validate the offset variable before use.
- Check the function signature in ScriptValuesAddedFunctions when in doubt.
When it happens
Trigger: Calling getFiscalDate(date) with one argument, or with three, in a Modified Java Script Value step.
Common situations: Forgetting the second argument (days to add); passing arguments separated by the wrong delimiter so they parse as one; assuming a default fiscal offset exists.
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 abs requires 1 argument.
- The function call appendToFile requires arguments.
- The function call ceil requires 1 argument.
- The function call floor requires 1 argument.
- The function call getDayNumber requires 2 arguments.
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/c418f00ac7b09e44.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:257
Calendar startDate = Calendar.getInstance();
Calendar fisStartDate = Calendar.getInstance();
Calendar fisOffsetDate = Calendar.getInstance();
startDate.setTime( dIn );
Format dfFormatter = new SimpleDateFormat( "dd.MM.yyyy" );
String strOffsetDate = Context.toString( ArgList[1] ) + String.valueOf( startDate.get( Calendar.YEAR ) );
java.util.Date dOffset = (java.util.Date) dfFormatter.parseObject( strOffsetDate );
fisOffsetDate.setTime( dOffset );
String strFisStartDate = "01.01." + String.valueOf( startDate.get( Calendar.YEAR ) + 1 );
fisStartDate.setTime( (java.util.Date) dfFormatter.parseObject( strFisStartDate ) );
int iDaysToAdd = (int) ( ( startDate.getTimeInMillis() - fisOffsetDate.getTimeInMillis() ) / 86400000 );
fisStartDate.add( Calendar.DATE, iDaysToAdd );
return fisStartDate.getTime();
} catch ( Exception e ) {
throw Context.reportRuntimeError( e.toString() );
}
} else {
throw Context.reportRuntimeError( "The function call getFiscalDate requires 2 arguments." );
}
}
public static double getProcessCount( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function FunctionContext ) {
if ( ArgList.length == 1 ) {
try {
Object scmO = actualObject.get( "_step_", actualObject );
StepInterface scm = (StepInterface) Context.jsToJava( scmO, StepInterface.class );
String strType = Context.toString( ArgList[0] ).toLowerCase();
if ( strType.equals( "i" ) ) {
return scm.getLinesInput();
} else if ( strType.equals( "o" ) ) {
return scm.getLinesOutput();
} else if ( strType.equals( "r" ) ) {View on GitHub (pinned to f3058517a1)