{"record":{"id":"8d3d772234fc925d","repo":"pentaho/pentaho-kettle","slug":"the-function-call-getprocesscount-requires-1-argument-8d3d77","errorCode":null,"errorMessage":"The function call getProcessCount requires 1 argument.","messagePattern":"The function call getProcessCount requires 1 argument\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java","lineNumber":291,"sourceCode":"        } else if ( strType.equals( \"o\" ) ) {\n          return scm.getLinesOutput();\n        } else if ( strType.equals( \"r\" ) ) {\n          return scm.getLinesRead();\n        } else if ( strType.equals( \"u\" ) ) {\n          return scm.getLinesUpdated();\n        } else if ( strType.equals( \"w\" ) ) {\n          return scm.getLinesWritten();\n        } else if ( strType.equals( \"e\" ) ) {\n          return scm.getLinesRejected();\n        } else {\n          return 0;\n        }\n      } catch ( Exception e ) {\n        // throw Context.reportRuntimeError(e.toString());\n        return 0;\n      }\n    } else {\n      throw Context.reportRuntimeError( \"The function call getProcessCount requires 1 argument.\" );\n    }\n  }\n\n  public static void writeToLog( Context actualContext, Scriptable actualObject, Object[] ArgList,\n    Function FunctionContext ) {\n\n    switch ( ArgList.length ) {\n      case 1:\n        try {\n          if ( !isNull( ArgList ) && !isUndefined( ArgList ) ) {\n            Object scmO = actualObject.get( \"_step_\", actualObject );\n            ScriptValuesMod scm = (ScriptValuesMod) Context.jsToJava( scmO, ScriptValuesMod.class );\n            String strMessage = Context.toString( ArgList[0] );\n            scm.logDebug( strMessage );\n          }\n        } catch ( Exception e ) {\n          // Ignore errors\n        }","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java#L273-L309","documentation":"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.","triggerScenarios":"Calling getProcessCount() with an empty argument list in a Modified Java Script Value step.","commonSituations":"Exploring the available script functions and invoking without arguments; a variable holding the step name was deleted leaving a bare call.","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."],"exampleFix":"// before\nvar c = getProcessCount();\n// after\nvar c = getProcessCount('Filter rows');","handlingStrategy":"validation","validationCode":"var stepName = 'Filter rows';\nif (typeof stepName !== 'string' || stepName.length === 0) {\n  throw 'getProcessCount needs a non-empty step name';\n}\nvar count = getProcessCount(stepName);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["javascript","argument-count","pdi-kettle"],"backgroundTag":"missing-required-argument","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}