{"record":{"id":"46b2d07e3d8bf0f5","repo":"pentaho/pentaho-kettle","slug":"the-function-call-lower-is-not-valid-e-getmessage-46b2d0","errorCode":null,"errorMessage":"The function call lower is not valid : {e.getMessage()}","messagePattern":"The function call lower is not valid : (.+?)","errorType":"exception","errorClass":"JavaScriptException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java","lineNumber":1320,"sourceCode":"      throw Context.reportRuntimeError( \"The function call upper requires 1 argument.\" );\n    }\n    return sRC;\n  }\n\n  public static String lower( Context actualContext, Scriptable actualObject, Object[] ArgList,\n    Function 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) Context.getUndefinedValue();\n        }\n        sRC = Context.toString( ArgList[0] );\n        sRC = sRC.toLowerCase();\n      } catch ( Exception e ) {\n        throw Context.reportRuntimeError( \"The function call lower is not valid : \" + e.getMessage() );\n      }\n    } else {\n      throw Context.reportRuntimeError( \"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( Context actualContext, Scriptable actualObject, Object[] ArgList,\n    Function FunctionContext ) {\n    String sRC = \"\";\n    switch ( ArgList.length ) {\n      case 0:\n        throw Context.reportRuntimeError( \"The function call num2str requires at least 1 argument.\" );\n      case 1:\n        try {\n          if ( isNull( ArgList[0] ) ) {\n            return null;","sourceCodeStart":1302,"sourceCodeEnd":1338,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java#L1302-L1338","documentation":"The lower() counterpart of error 2016: thrown when lower(x) fails while converting its argument to a string and lowercasing it. Exceptions from Context.toString(ArgList[0]) or toLowerCase() are caught and re-thrown as 'The function call lower is not valid : ' + e.getMessage(), masking the original cause.","triggerScenarios":"Calling lower(x) where x is a complex/Java-wrapped object that cannot be stringified, a value whose conversion throws in the Rhino context, or an internal failure during toLowerCase on unusual input.","commonSituations":"Applying lower() to binary or Blob fields; passing NativeJavaObject values from earlier Java-class steps; scripts using undefined row variables that resolve to odd Java objects.","solutions":["Coerce explicitly first: lower(String(value)).","Inspect the e.getMessage() suffix for the real conversion error.","Null-check before calling: value == null ? null : lower(value).","Convert Java objects to strings in the previous step rather than inside the script."],"exampleFix":"// before\nvar l = lower(emailObj)\n// after\nvar l = (emailObj == null) ? null : lower(String(emailObj))","handlingStrategy":"type-guard","validationCode":"// JS\nfunction safeLower(v) { return (v == null) ? null : lower(String(v)); }","typeGuard":"function isStringLike(v) { return typeof v === 'string' || typeof v === 'number'; }","tryCatchPattern":"try { l = lower(v); } catch (e) { l = null; logError(\"lower failed: \" + e.message); }","preventionTips":["Do not pass binary/Blob fields to lower","Coerce Java-wrapped objects with String() first","Null-check the value before calling","Inspect the message suffix for real cause"],"tags":["javascript","string","pentaho-kettle"],"backgroundTag":"invalid-argument-value","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"}