pentaho/pentaho-kettle · error

The function call ceil requires 1 argument.

Error message

The function call ceil requires 1 argument.

What it means

Arity guard for ceil in the Rhino script-values step: Math.ceil must be applied to exactly one numeric argument. Null/undefined inputs return NaN/undefined; only a wrong argument count reaches this throw.

Solutions

  1. Call ceil with exactly one argument: ceil(value).
  2. For rounding to digits, implement manually, e.g. Math.ceil(x*100)/100.
  3. Verify no stray comma created an extra argument.

Example fix

// before
var c = ceil(amount, 2);
// after
var c = Math.ceil(amount * 100) / 100;
Defensive patterns

Strategy: validation

Validate before calling

var x = +(amount);
if (isNaN(x)) x = 0;
var c = ceil(x);

Type guard

function isNumber(v){ return typeof v === 'number' && !isNaN(v); }

Prevention

When it happens

Trigger: ceil() with zero arguments or ceil(a, b) with two arguments.

Common situations: Trying a precision-argument variant (ceil(x, digits)) that this wrapper does not support; testing the function with no args.

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

Appendix: source

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

    }
  }

  public static Object ceil( Context actualContext, Scriptable actualObject, Object[] ArgList,
    Function FunctionContext ) {
    if ( ArgList.length == 1 ) {
      try {
        if ( isNull( ArgList[0] ) ) {
          return Double.NaN;
        } else if ( isUndefined( ArgList[0] ) ) {
          return Context.getUndefinedValue();
        } else {
          return Math.ceil( Context.toNumber( ArgList[ 0 ] ) );
        }
      } catch ( Exception e ) {
        return null;
      }
    } else {
      throw Context.reportRuntimeError( "The function call ceil requires 1 argument." );
    }
  }

  public static Object floor( Context actualContext, Scriptable actualObject, Object[] ArgList,
    Function FunctionContext ) {
    if ( ArgList.length == 1 ) {
      try {
        if ( isNull( ArgList[0] ) ) {
          return new Double( Double.NaN );
        } else if ( isUndefined( ArgList[0] ) ) {
          return Context.getUndefinedValue();
        } else {
          return new Double( Math.floor( Context.toNumber( ArgList[0] ) ) );
        }
      } catch ( Exception e ) {
        return null;
        // throw Context.reportRuntimeError(e.toString());
      }

View on GitHub (pinned to f3058517a1)