pentaho/pentaho-kettle · error · RuntimeException

The function call isNum requires 1 argument.

Error message

The function call isNum requires 1 argument.

What it means

isNum is a JS-added function that checks whether its single argument can be evaluated as a number. If ArgList.length != 1 (zero arguments or more than one), it throws this RuntimeException instead of returning a boolean.

Solutions

  1. Call isNum with exactly one argument; wrap multiple checks in separate calls.
  2. Fix call sites that pass two values due to stray commas.
  3. Combine checks manually: isNum(a) && isNum(b).

Example fix

// before
var ok = isNum(a, b); // throws
// after
var ok = isNum(a) && isNum(b);
Defensive patterns

Strategy: validation

Validate before calling

function safeIsNum(v) {
  return (arguments.length === 1) ? isNum(v) : false;
}

Type guard

function isNumLike(v) {
  return typeof v === 'number' || (typeof v === 'string' && v.trim() !== '' && !isNaN(Number(v)));
}

Try / catch

try {
  var ok = isNum(v);
} catch (e) {
  // wrong arity: review the call site
  var ok = false;
}

Prevention

When it happens

Trigger: Calling isNum() with no arguments, or isNum(a, b) with multiple arguments in a JavaScript transformation step.

Common situations: Passing several values hoping for a batch check, forgetting an argument, typo-ing a comma so two values are passed.

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

Appendix: source

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

    if ( ArgList.length == 1 ) {
      try {
        if ( isNull( ArgList[0] ) ) {
          return null;
        } else if ( isUndefined( ArgList[0] ) ) {
          return undefinedValue;
        }
        double sArg1 = (Double) ArgList[0];
        if ( Double.isNaN( sArg1 ) ) {
          return Boolean.FALSE;
        } else {
          return Boolean.TRUE;
        }
      } catch ( Exception e ) {
        return Boolean.FALSE;
      }
    } else {
      throw new RuntimeException( "The function call isNum requires 1 argument." );
    }
  }

  public static Object isDate( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,
    Object FunctionContext ) {

    if ( ArgList.length == 1 ) {
      try {
        if ( isNull( ArgList[0] ) ) {
          return null;
        } else if ( isUndefined( ArgList[0] ) ) {
          return undefinedValue;
        }
        /* java.util.Date d = (java.util.Date) */
        return Boolean.TRUE;
      } catch ( Exception e ) {
        return Boolean.FALSE;
      }

View on GitHub (pinned to f3058517a1)