{"record":{"id":"c210fa384a5a1cb9","repo":"pentaho/pentaho-kettle","slug":"the-function-call-removedigits-requires-1-argument","errorCode":null,"errorMessage":"The function call removeDigits requires 1 argument.","messagePattern":"The function call removeDigits requires 1 argument\\.","errorType":"exception","errorClass":"Rhino runtime error","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java","lineNumber":2770,"sourceCode":"    }\n  }\n\n  public static String protectXMLCDATA( Context actualContext, Scriptable actualObject, Object[] ArgList,\n    Function FunctionContext ) {\n    if ( ArgList.length == 1 ) {\n      return Const.protectXMLCDATA( Context.toString( ArgList[0] ) );\n    } else {\n      throw Context.reportRuntimeError( \"The function call protectXMLCDATA requires 1 argument.\" );\n\n    }\n  }\n\n  public static String removeDigits( Context actualContext, Scriptable actualObject, Object[] ArgList,\n    Function FunctionContext ) {\n    if ( ArgList.length == 1 ) {\n      return Const.removeDigits( Context.toString( ArgList[0] ) );\n    } else {\n      throw Context.reportRuntimeError( \"The function call removeDigits requires 1 argument.\" );\n\n    }\n  }\n\n  public static String initCap( Context actualContext, Scriptable actualObject, Object[] ArgList,\n    Function FunctionContext ) {\n    if ( ArgList.length == 1 ) {\n      return Const.initCap( Context.toString( ArgList[0] ) );\n    } else {\n      throw Context.reportRuntimeError( \"The function call initCap requires 1 argument.\" );\n\n    }\n  }\n\n  public static Object loadFileContent( Context actualContext, Scriptable actualObject, Object[] ArgList,\n    Function FunctionContext ) {\n    Object oRC = new Object();\n    try {","sourceCodeStart":2752,"sourceCodeEnd":2788,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java#L2752-L2788","documentation":"removeDigits strips digit characters from a string via Const.removeDigits in the Modified Java Script Value step. The wrapper throws this Rhino runtime error whenever the function is called with anything other than exactly one argument.","triggerScenarios":"removeDigits() with no argument, or removeDigits(s, x) with extra arguments; the length==1 check fails and Context.reportRuntimeError fires.","commonSituations":"Users adding a second argument expecting a regex mode; argument variable left undefined after renaming a field, producing a zero-arg call.","solutions":["Call removeDigits with exactly one argument: removeDigits(inputString)","If custom digit filtering is needed, use str.replace(/\\d/g,'') directly in the script","Validate the field variable is defined before passing it"],"exampleFix":"// before\nvar cleaned = removeDigits(value, \"/d\");\n// after\nvar cleaned = removeDigits(value);","handlingStrategy":"validation","validationCode":"if (typeof value === 'string') { var cleaned = removeDigits(value); }","typeGuard":"function isString(v){ return typeof v === 'string'; }","tryCatchPattern":"try { var cleaned = removeDigits(value); } catch (e) { throw new Error('removeDigits requires exactly 1 argument: ' + e.message); }","preventionTips":["Use inline regex for custom filtering instead of extra args","Ensure argument variables are defined at runtime","Test with representative rows before running the transformation"],"tags":["javascript","string","argument-count","pentaho-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"}