pentaho/pentaho-kettle · error · RuntimeException

The function call lower requires 1 argument.

Error message

The function call lower requires 1 argument.

What it means

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.

Solutions

  1. Call lower with exactly one string argument.
  2. Chain calls for multiple fields: lower(a); lower(b) on separate target fields.

Example fix

// before
lower(firstName, lastName)
// after
// use two script fields:
// f = lower(firstName); l = lower(lastName)
Defensive patterns

Strategy: validation

Validate before calling

function safeLower(v) { if (arguments.length !== 1) throw new Error('lower needs exactly 1 argument'); return lower(v); }

Try / catch

try { return lower(v); }
catch (e) { if (/requires 1 argument/.test(e.message)) return null; throw e; }

Prevention

When it happens

Trigger: lower() with 0 arguments or multiple arguments, e.g. lower(a, b).

Common situations: Multi-column normalization attempts in one call; missing argument after editing a script.

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


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/6cbe7e5b755dd322. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:1289

  }

  public static String lower( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,
    Object FunctionContext ) {
    String sRC = "";
    if ( ArgList.length == 1 ) {
      try {
        if ( isNull( ArgList[0] ) ) {
          return null;
        } else if ( isUndefined( ArgList[0] ) ) {
          return (String) undefinedValue;
        }
        sRC = (String) ArgList[0];
        sRC = sRC.toLowerCase();
      } catch ( Exception e ) {
        throw new RuntimeException( "The function call lower is not valid : " + e.getMessage() );
      }
    } else {
      throw new RuntimeException( "The function call lower requires 1 argument." );
    }
    return sRC;
  }

  // Converts the given Numeric to a JScript String
  public static String num2str( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,
    Object FunctionContext ) {
    String sRC = "";
    switch ( ArgList.length ) {
      case 0:
        throw new RuntimeException( "The function call num2str requires at least 1 argument." );
      case 1:
        try {
          if ( isNull( ArgList[0] ) ) {
            return null;
          } else if ( isUndefined( ArgList[0] ) ) {
            return (String) undefinedValue;
          }

View on GitHub (pinned to f3058517a1)