{"record":{"id":"677ac805e47ef1ce","repo":"pentaho/pentaho-kettle","slug":"the-function-call-ceil-requires-1-argument-677ac8","errorCode":null,"errorMessage":"The function call ceil requires 1 argument.","messagePattern":"The function call ceil requires 1 argument\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java","lineNumber":412,"sourceCode":"    }\n  }\n\n  public static Object ceil( Context actualContext, Scriptable actualObject, Object[] ArgList,\n    Function FunctionContext ) {\n    if ( ArgList.length == 1 ) {\n      try {\n        if ( isNull( ArgList[0] ) ) {\n          return Double.NaN;\n        } else if ( isUndefined( ArgList[0] ) ) {\n          return Context.getUndefinedValue();\n        } else {\n          return Math.ceil( Context.toNumber( ArgList[ 0 ] ) );\n        }\n      } catch ( Exception e ) {\n        return null;\n      }\n    } else {\n      throw Context.reportRuntimeError( \"The function call ceil requires 1 argument.\" );\n    }\n  }\n\n  public static Object floor( Context actualContext, Scriptable actualObject, Object[] ArgList,\n    Function FunctionContext ) {\n    if ( ArgList.length == 1 ) {\n      try {\n        if ( isNull( ArgList[0] ) ) {\n          return new Double( Double.NaN );\n        } else if ( isUndefined( ArgList[0] ) ) {\n          return Context.getUndefinedValue();\n        } else {\n          return new Double( Math.floor( Context.toNumber( ArgList[0] ) ) );\n        }\n      } catch ( Exception e ) {\n        return null;\n        // throw Context.reportRuntimeError(e.toString());\n      }","sourceCodeStart":394,"sourceCodeEnd":430,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java#L394-L430","documentation":"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.","triggerScenarios":"ceil() with zero arguments or ceil(a, b) with two arguments.","commonSituations":"Trying a precision-argument variant (ceil(x, digits)) that this wrapper does not support; testing the function with no args.","solutions":["Call ceil with exactly one argument: ceil(value).","For rounding to digits, implement manually, e.g. Math.ceil(x*100)/100.","Verify no stray comma created an extra argument."],"exampleFix":"// before\nvar c = ceil(amount, 2);\n// after\nvar c = Math.ceil(amount * 100) / 100;","handlingStrategy":"validation","validationCode":"var x = +(amount);\nif (isNaN(x)) x = 0;\nvar c = ceil(x);","typeGuard":"function isNumber(v){ return typeof v === 'number' && !isNaN(v); }","tryCatchPattern":null,"preventionTips":["One argument only; no precision parameter exists in this wrapper.","Prefer built-in Math.ceil when extra logic is needed.","Watch for stray commas creating phantom arguments."],"tags":["javascript","argument-count","math","pdi-kettle"],"backgroundTag":"missing-required-argument","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}