pentaho/pentaho-kettle · error · RuntimeException
The function call upper requires 1 argument.
Error message
The function call upper requires 1 argument.
What it means
Arity guard in ScriptAddedFunctions.upper: the script call supplied an argument list whose length is not 1. The single expected argument is a String to upper-case (null returns null); with any other count the RuntimeException is thrown to the script engine.
Solutions
- Call upper with exactly one string argument.
- Concatenate first, then uppercase: upper(a + ' ' + b).
Example fix
// before upper(firstName, lastName) // after upper(firstName + ' ' + lastName)
Defensive patterns
Strategy: validation
Validate before calling
function safeUpper(v) { if (arguments.length !== 1) throw new Error('upper needs exactly 1 argument'); return upper(v); } Try / catch
try { return upper(v); }
catch (e) { if (/requires 1 argument/.test(e.message)) return null; throw e; } Prevention
- One field per upper() call; combine strings before or after, not inside.
- Review scripts after refactoring to ensure arguments were not dropped.
When it happens
Trigger: upper() called with 0 arguments or 2+ arguments, e.g. upper(first, last).
Common situations: Attempting C-style multi-arg concatenation; forgetting the argument after a refactor; passing extra options that the function does not accept.
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 lower requires 1 argument.
- The function call date2str requires 1, 2, 3, or 4 arguments.
- The function call fillString requires 2 arguments.
- The function call initCap requires 1 argument.
- The function call lower is not valid : " + e.getMessage()
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/0f82d12bb8647970.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:1268
}
public static String upper( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,
Object FunctionContext ) {
String sRC = "";
if ( ArgList.length == 1 ) {
try {
if ( isNull( ArgList[0] ) ) {
return null;
} else if ( isUndefined( ArgList[0] ) ) {
return (String) undefinedValue;
}
sRC = (String) ArgList[0];
sRC = sRC.toUpperCase();
} catch ( Exception e ) {
throw new RuntimeException( "The function call upper is not valid : " + e.getMessage() );
}
} else {
throw new RuntimeException( "The function call upper requires 1 argument." );
}
return sRC;
}
public static String lower( ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,
Object FunctionContext ) {
String sRC = "";
if ( ArgList.length == 1 ) {
try {
if ( isNull( ArgList[0] ) ) {
return null;
} else if ( isUndefined( ArgList[0] ) ) {
return (String) undefinedValue;
}
sRC = (String) ArgList[0];
sRC = sRC.toLowerCase();
} catch ( Exception e ) {
throw new RuntimeException( "The function call lower is not valid : " + e.getMessage() );View on GitHub (pinned to f3058517a1)