pentaho/pentaho-kettle · error

The function call isEmpty is not valid

Error message

The function call isEmpty is not valid

What it means

isEmpty(value) requires exactly one argument. When the JS call's argument list does not match the expected signature (wrong count), the code short-circuits to this 'not valid' runtime error before attempting the emptiness check. It is a signature-validation failure, distinct from the wrapped internal 'Error in isEmpty function:' message.

Solutions

  1. Call isEmpty with exactly one argument: isEmpty(fieldName).
  2. Guard: if (typeof fieldName != 'undefined' && fieldName != null) { ... }.
  3. Use JS length checks yourself if you need multi-value emptiness: isEmpty(a) || isEmpty(b).
  4. Fix variable name typos that leave the expression evaluating with wrong arity.

Example fix

// before
var e = isEmpty(a, b);
// after
var e = isEmpty(a) || isEmpty(b);
Defensive patterns

Strategy: validation

Validate before calling

function safeIsEmpty1(v) { if (typeof v === 'undefined') return true; try { return isEmpty(v); } catch (e) { return true; } }

Type guard

function hasOneArg(v) { return typeof v !== 'undefined' && v !== null; }

Try / catch

try { e = isEmpty(val); } catch (ex) { if (ex.message.indexOf('not valid') >= 0) { e = true; } else { throw ex; } }

Prevention

When it happens

Trigger: isEmpty() with zero arguments, isEmpty(a, b) with extra arguments, or a call where ArgList length fails the function's check in the Modified Java Script Value step.

Common situations: Undefined variable making the call site look malformed; copy-paste of ISNULL/ISempty variants from other engines with different arities; refactors leaving stale extra parameters.

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/3ed09dc180c2dd84. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:2672

    if ( ArgList.length == 1 ) {
      try {
        if ( isUndefined( ArgList[0] ) ) {
          throw new Exception( ArgList[0] + " is  undefined!" );
        }
        if ( isNull( ArgList[0] ) ) {
          return Boolean.TRUE;
        }
        if ( Context.toString( ArgList[0] ).length() == 0 ) {
          return Boolean.TRUE;
        } else {
          return Boolean.FALSE;
        }

      } catch ( Exception e ) {
        throw Context.reportRuntimeError( "Error in isEmpty function: " + e.getMessage() );
      }
    } else {
      throw Context.reportRuntimeError( "The function call isEmpty is not valid" );
    }
  }

  public static Boolean isMailValid( Context actualContext, Scriptable actualObject, Object[] ArgList,
    Function FunctionContext ) {
    Boolean isValid;
    if ( ArgList.length == 1 ) {
      try {
        if ( isUndefined( ArgList[0] ) ) {
          throw new Exception( ArgList[0] + " is  undefined!" );
        }
        if ( isNull( ArgList[0] ) ) {
          return Boolean.FALSE;
        }
        if ( Context.toString( ArgList[0] ).length() == 0 ) {
          return Boolean.FALSE;
        }

View on GitHub (pinned to f3058517a1)