{"record":{"id":"6cbe7e5b755dd322","repo":"pentaho/pentaho-kettle","slug":"the-function-call-lower-requires-1-argument","errorCode":null,"errorMessage":"The function call lower requires 1 argument.","messagePattern":"The function call lower requires 1 argument\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java","lineNumber":1289,"sourceCode":"  }\n\n  public static String lower( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,\n    Object FunctionContext ) {\n    String sRC = \"\";\n    if ( ArgList.length == 1 ) {\n      try {\n        if ( isNull( ArgList[0] ) ) {\n          return null;\n        } else if ( isUndefined( ArgList[0] ) ) {\n          return (String) undefinedValue;\n        }\n        sRC = (String) ArgList[0];\n        sRC = sRC.toLowerCase();\n      } catch ( Exception e ) {\n        throw new RuntimeException( \"The function call lower is not valid : \" + e.getMessage() );\n      }\n    } else {\n      throw new RuntimeException( \"The function call lower requires 1 argument.\" );\n    }\n    return sRC;\n  }\n\n  // Converts the given Numeric to a JScript String\n  public static String num2str( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,\n    Object FunctionContext ) {\n    String sRC = \"\";\n    switch ( ArgList.length ) {\n      case 0:\n        throw new RuntimeException( \"The function call num2str requires at least 1 argument.\" );\n      case 1:\n        try {\n          if ( isNull( ArgList[0] ) ) {\n            return null;\n          } else if ( isUndefined( ArgList[0] ) ) {\n            return (String) undefinedValue;\n          }","sourceCodeStart":1271,"sourceCodeEnd":1307,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java#L1271-L1307","documentation":"Arity guard in ScriptAddedFunctions.lower: the script call's ArgList length is not 1. The single expected argument is a String to lower-case (null returns null, undefined yields undefined); any other count raises this RuntimeException to the script.","triggerScenarios":"lower() with 0 arguments or multiple arguments, e.g. lower(a, b).","commonSituations":"Multi-column normalization attempts in one call; missing argument after editing a script.","solutions":["Call lower with exactly one string argument.","Chain calls for multiple fields: lower(a); lower(b) on separate target fields."],"exampleFix":"// before\nlower(firstName, lastName)\n// after\n// use two script fields:\n// f = lower(firstName); l = lower(lastName)","handlingStrategy":"validation","validationCode":"function safeLower(v) { if (arguments.length !== 1) throw new Error('lower needs exactly 1 argument'); return lower(v); }","typeGuard":null,"tryCatchPattern":"try { return lower(v); }\ncatch (e) { if (/requires 1 argument/.test(e.message)) return null; throw e; }","preventionTips":["Call lower once per field; do not pass multiple columns in one call.","Lint scripts for function calls with wrong arity before saving the transform."],"tags":["javascript","scripting-step","argument-count","string"],"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"}