pentaho/pentaho-kettle · error · RuntimeException
The function call LuhnCheck requires 1 argument.
Error message
The function call LuhnCheck requires 1 argument.
What it means
Arity guard in ScriptAddedFunctions.LuhnCheck: the function was invoked from a script with an ArgList whose length is not 1, so the Luhn checksum cannot be computed. The input at fault is the script's argument list; the intended single string argument must be numeric-parsable, otherwise the function silently returns false.
Solutions
- Call LuhnCheck with exactly one argument containing the full number
- Pre-compute/strip any extra values in JS before the call
- Use a JS wrapper that enforces arity
Example fix
// before var ok = LuhnCheck(cardNum, 7); // after var ok = LuhnCheck(cardNum);
Defensive patterns
Strategy: validation
Validate before calling
// JS in Script step
if (arguments.length !== 1) {
throw new Error('LuhnCheck expects exactly one argument');
}
var ok = LuhnCheck(String(cardNum)); Type guard
// JS
function isSingleArg(args) {
return args.length === 1;
} Try / catch
try {
var ok = LuhnCheck(cardNum);
} catch (e) {
Logger.logError('LuhnCheck failed: ' + e.message);
ok = false;
} Prevention
- Pass the full number including check digit as a single string
- Do not split number/check digit into separate arguments
- Review Kettle added-functions javadoc for exact signatures
When it happens
Trigger: Calling LuhnCheck() with zero args or with multiple args (e.g. LuhnCheck(num, expectedCheckDigit)) inside a Script step.
Common situations: Assuming the check digit can be passed separately; translating pseudocode that splits the number into parts.
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 abs requires 1 argument.
- The function call appendToFile requires arguments.
- The function call ceil requires 1 argument.
- The function call getDigitsOnly requires 1 argument.
- The function call getFiscalDate requires 2 arguments.
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/54e4faa8085f4706.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:154
} 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 new RuntimeException( "The function call LuhnCheck requires 1 argument." );
}
return returnCode;
}
public static int indexOf( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,
Object FunctionContext ) {
int returnIndex = -1;
if ( ArgList.length == 2 || ArgList.length == 3 ) {
if ( !isNull( ArgList ) && !isUndefined( ArgList ) ) {
String string = (String) ArgList[0];
String subString = (String) ArgList[1];
int fromIndex = 0;
if ( ArgList.length == 3 ) {
fromIndex = (int) Math.round( (Double) ArgList[2] );View on GitHub (pinned to f3058517a1)