pentaho/pentaho-kettle · error · RuntimeException

The function call ceil requires 1 argument.

Error message

The function call ceil requires 1 argument.

What it means

Arity guard in ScriptAddedFunctions.ceil: the script call supplied an ArgList whose length is not 1. With exactly one numeric argument the function returns Math.ceil as a Double (null/undefined input maps to NaN); any other argument count raises this RuntimeException to the script.

Solutions

  1. Call ceil with exactly one numeric argument
  2. Implement rounding-to-precision manually in JS if needed (Math.ceil(x*p)/p)
  3. Guard that the argument is a Number before calling

Example fix

// before
var v = ceil(x, 2);
// after
var v = ceil(x * 100) / 100;
Defensive patterns

Strategy: validation

Validate before calling

// JS in Script step
if (arguments.length !== 1 || typeof arguments[0] !== 'number') {
  throw new Error('ceil expects exactly one numeric argument');
}
var v = ceil(x);

Type guard

// JS
function isSingleNumber(args) {
  return args.length === 1 && typeof args[0] === 'number' && !isNaN(args[0]);
}

Try / catch

try {
  var v = ceil(x);
  if (v === null) { /* non-numeric input case */ }
} catch (e) {
  Logger.logError('ceil failed: ' + e.message);
  v = null;
}

Prevention

When it happens

Trigger: Calling ceil() with zero arguments or ceil(x, precision) with two arguments in a Script step.

Common situations: Expecting a precision parameter like some spreadsheet CEIL functions; typos in generated scripts.

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

Appendix: source

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

    }
  }

  public static Object ceil( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,
    Object FunctionContext ) {
    if ( ArgList.length == 1 ) {
      try {
        if ( isNull( ArgList[0] ) ) {
          return new Double( Double.NaN );
        } else if ( isUndefined( ArgList[0] ) ) {
          return undefinedValue;
        } else {
          return new Double( Math.ceil( (Double) ArgList[0] ) );
        }
      } catch ( Exception e ) {
        return null;
      }
    } else {
      throw new RuntimeException( "The function call ceil requires 1 argument." );
    }
  }

  public static Object floor( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,
    Object FunctionContext ) {
    if ( ArgList.length == 1 ) {
      try {
        if ( isNull( ArgList[0] ) ) {
          return new Double( Double.NaN );
        } else if ( isUndefined( ArgList[0] ) ) {
          return undefinedValue;
        } else {
          return new Double( Math.floor( (Double) ArgList[0] ) );
        }
      } catch ( Exception e ) {
        return null;
        // throw new RuntimeException(e.toString());
      }

View on GitHub (pinned to f3058517a1)