pentaho/pentaho-kettle · error · JavaScriptException
The function call str2date requires 1, 2, 3, or 4 arguments.
Error message
The function call str2date requires 1, 2, 3, or 4 arguments.
What it means
Arity guard at the default branch of str2date's argument-count switch: the call used more than 4 arguments. Only 1 (string), 2 (+format), 3 (+locale), and 4 (+timezone) forms are supported; anything else falls through to this throw.
Solutions
- Reduce the call to at most four arguments: string, format, locale, timezone
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:1116 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/e9852fa9590bdd37.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:1116
TimeZone tz = TimeZone.getTimeZone( sArg4 );
if ( sArg3.length() == 2 ) {
Locale dfLocale = EnvUtil.createLocale( sArg3 );
dfFormatter = new SimpleDateFormat( sArg2, dfLocale );
dfFormatter.setTimeZone( tz );
oRC = dfFormatter.parseObject( sArg1 );
} else {
throw Context.reportRuntimeError( "Locale " + sArg3 + " is not 2 characters long." );
}
} catch ( Exception e ) {
throw Context
.reportRuntimeError( "Could not apply the local format for locale "
+ sArg3 + " with the given format " + sArg2 + " on the string for " + sArg1 + " : "
+ e.getMessage() );
}
break;
default:
throw Context.reportRuntimeError( "The function call str2date requires 1, 2, 3, or 4 arguments." );
}
return oRC;
}
public static Object date2str( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function FunctionContext ) {
Object oRC = new Object();
switch ( ArgList.length ) {
case 0:
throw Context.reportRuntimeError( "Please provide a valid date to the function call date2str." );
case 1:
try {
if ( isNull( ArgList ) ) {
return null;
} else if ( isUndefined( ArgList ) ) {
return Context.getUndefinedValue();
}
java.util.Date dArg1 = (java.util.Date) Context.jsToJava( ArgList[0], java.util.Date.class );View on GitHub (pinned to f3058517a1)