pentaho/pentaho-kettle · error
The function call getProcessCount requires 1 argument.
Error message
The function call getProcessCount requires 1 argument.
What it means
Arity guard for getProcessCount in the Rhino-based script-values step: it takes exactly one argument, a letter selecting which counter to return (i=input, o=output, r=read, u=updated, w=written, e=rejected). Any other count throws; note that an unrecognized letter silently returns 0 instead.
Solutions
- Pass the step name: getProcessCount('Step name').
- Confirm the step name string is not empty before calling.
- Use the actual step label exactly as it appears on the transformation canvas.
Example fix
// before
var c = getProcessCount();
// after
var c = getProcessCount('Filter rows'); Defensive patterns
Strategy: validation
Validate before calling
var stepName = 'Filter rows';
if (typeof stepName !== 'string' || stepName.length === 0) {
throw 'getProcessCount needs a non-empty step name';
}
var count = getProcessCount(stepName); Prevention
- Store step names in constants and reuse them.
- Match step names exactly as shown on the canvas.
- Don't invoke functions just to 'see what happens' in production scripts.
When it happens
Trigger: Calling getProcessCount() with an empty argument list in a Modified Java Script Value step.
Common situations: Exploring the available script functions and invoking without arguments; a variable holding the step name was deleted leaving a bare call.
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/8d3d772234fc925d.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:291
} else if ( strType.equals( "o" ) ) {
return scm.getLinesOutput();
} else if ( strType.equals( "r" ) ) {
return scm.getLinesRead();
} else if ( strType.equals( "u" ) ) {
return scm.getLinesUpdated();
} else if ( strType.equals( "w" ) ) {
return scm.getLinesWritten();
} else if ( strType.equals( "e" ) ) {
return scm.getLinesRejected();
} else {
return 0;
}
} catch ( Exception e ) {
// throw Context.reportRuntimeError(e.toString());
return 0;
}
} else {
throw Context.reportRuntimeError( "The function call getProcessCount requires 1 argument." );
}
}
public static void writeToLog( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function FunctionContext ) {
switch ( ArgList.length ) {
case 1:
try {
if ( !isNull( ArgList ) && !isUndefined( ArgList ) ) {
Object scmO = actualObject.get( "_step_", actualObject );
ScriptValuesMod scm = (ScriptValuesMod) Context.jsToJava( scmO, ScriptValuesMod.class );
String strMessage = Context.toString( ArgList[0] );
scm.logDebug( strMessage );
}
} catch ( Exception e ) {
// Ignore errors
}View on GitHub (pinned to f3058517a1)