pentaho/pentaho-kettle · error
The function call LuhnCheck requires 1 argument.
Error message
The function call LuhnCheck requires 1 argument.
What it means
LuhnCheck validates a number string using the Luhn algorithm and requires exactly one argument. When called with zero or multiple arguments it throws a Rhino RuntimeError: 'The function call LuhnCheck requires 1 argument.'
Solutions
- Pass exactly one argument (the numeric string) to LuhnCheck.
- Ensure the variable is defined before the call so you're not passing nothing/extra values.
- If validating multiple values, call the function once per value in a loop.
Example fix
// before var ok = LuhnCheck(cardNumber, true); // after var ok = LuhnCheck(cardNumber);
Defensive patterns
Strategy: type-guard
Validate before calling
// JS guard before calling if (cardNumber === undefined || cardNumber === null) return false; var ok = LuhnCheck(String(cardNumber));
Type guard
function safeLuhnCheck(v) {
if (v === null || v === undefined) return false;
return LuhnCheck(String(v));
} Try / catch
try { var ok = LuhnCheck(num); }
catch (e) { if (String(e).indexOf('requires 1 argument') >= 0) { /* fix arity */ } throw e; } Prevention
- Call with exactly one argument
- Validate the variable exists before the call
- Loop over multiple values instead of passing arrays/extra args
- Test in the script editor before production runs
When it happens
Trigger: Calling LuhnCheck() with an argument count other than 1 from JavaScript in a Script step, e.g. LuhnCheck(card) where card is undefined still counts as 1 arg, but LuhnCheck() or LuhnCheck(a, b) fails.
Common situations: Credit card validation scripts passing extra format options; forgetting to pass the variable; copying a call signature from a different utility.
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
- The function call getDigitsOnly requires 1 argument.
- The function call indexOf requires 2 or 3 arguments
- The function call copyFileis not valid.
- The function call getFileSize is not valid.
- The function call isEmpty is not valid
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/15b91cd2901344a6.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:172
} else {
addend = digit;
}
sum += addend;
timesTwo = !timesTwo;
}
int modulus = sum % 10;
if ( modulus == 0 ) {
returnCode = true;
}
} catch ( Exception e ) {
// No Need to throw exception
// This means that input can not be parsed to Integer
}
}
} else {
throw Context.reportRuntimeError( "The function call LuhnCheck requires 1 argument." );
}
return returnCode;
}
public static int indexOf( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function FunctionContext ) {
int returnIndex = -1;
if ( ArgList.length == 2 || ArgList.length == 3 ) {
if ( !isNull( ArgList ) && !isUndefined( ArgList ) ) {
String string = Context.toString( ArgList[0] );
String subString = Context.toString( ArgList[1] );
int fromIndex = 0;
if ( ArgList.length == 3 ) {
fromIndex = (int) Math.round( Context.toNumber( ArgList[2] ) );View on GitHub (pinned to f3058517a1)