pentaho/pentaho-kettle · error
The function call isMailValid is not valid
Error message
The function call isMailValid is not valid
What it means
In Pentaho Kettle's JavaScript scripting (ScriptValuesMod / Modified Java Script Value step), the isMailValid JS function validates an email address. This Rhino RuntimeControlError is thrown when the function is invoked with the wrong number of arguments, so the implementation skips its logic and reports that the call itself 'is not valid'. It is a scripting-layer misuse of a built-in JS helper, not a mail server failure.
Solutions
- Call isMailValid with exactly one argument, e.g. isMailValid(emailField)
- Check the function signature in ScriptValuesAddedFunctions.java and the Kettle JS function docs for your version
- Wrap the call in try/catch in the JS script to surface a friendlier message
- If a two-arg variant is needed, upgrade/downgrade to a Kettle version that supports it or implement regex validation inline
Example fix
// before var ok = isMailValid(email, "@company.com"); // after var ok = isMailValid(email);
Defensive patterns
Strategy: validation
Validate before calling
if (typeof email === 'string' && email.length > 0) { var ok = isMailValid(email); } else { var ok = false; } Type guard
function isNonEmptyString(v){ return typeof v === 'string' && v.length > 0; } Try / catch
try { var ok = isMailValid(email); } catch (e) { throw new Error('isMailValid call failed: ' + e.message); } Prevention
- Always call built-in JS functions with the documented argument count
- Test the script against one sample row before running the full transformation
- Check the function list in the Modified Java Script Value step for signatures
- Wrap risky script helpers in try/catch to fail with context
When it happens
Trigger: Calling isMailValid() with zero arguments, or with more than the expected single email argument inside a Modified Java Script Value step; the arg-count branch falls to the else and throws via Context.reportRuntimeError.
Common situations: Users pasting old scripts that call isMailValid with 2 args (email + pattern) after a Kettle upgrade changed the signature; typos passing no argument; concatenating arguments so the arg array is empty.
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
- Could not convert to the given local format.
- Please provide a valid date to the function call date2str.
- Row.EndOfFileReached
- Row.EndOfFileReadingRow
- Row.ErrorWritingRow
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/7120c1516226408a.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:2703
return Boolean.FALSE;
}
if ( Context.toString( ArgList[0] ).length() == 0 ) {
return Boolean.FALSE;
}
String email = Context.toString( ArgList[0] );
if ( email.indexOf( '@' ) == -1 || email.indexOf( '.' ) == -1 ) {
return Boolean.FALSE;
}
isValid = Boolean.TRUE;
} catch ( Exception e ) {
throw Context.reportRuntimeError( "Error in isMailValid function: " + e.getMessage() );
}
return isValid;
} else {
throw Context.reportRuntimeError( "The function call isMailValid is not valid" );
}
}
public static String escapeXml( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function FunctionContext ) {
if ( ArgList.length == 1 ) {
return Const.escapeXML( Context.toString( ArgList[0] ) );
} else {
throw Context.reportRuntimeError( "The function call escapeXml requires 1 argument." );
}
}
public static String escapeHtml( Context actualContext, Scriptable actualObject, Object[] ArgList,
Function FunctionContext ) {
if ( ArgList.length == 1 ) {
return Const.escapeHtml( Context.toString( ArgList[0] ) );
} else {View on GitHub (pinned to f3058517a1)