pentaho/pentaho-kettle · error · RuntimeException
The function call isFile is not valid.
Error message
The function call isFile is not valid.
What it means
Thrown by ScriptAddedFunctions.isFile when the argument list does not have the valid shape for the function. isFile expects exactly one argument (the path string); any other count triggers 'The function call isFile is not valid.' The same outer catch also rethrows unrelated exceptions as e.toString() at this site.
Solutions
- Call isFile with exactly one string path argument.
- Remove extra arguments that this function does not accept.
- If the message is e.toString() instead, inspect it for the underlying exception cause.
Example fix
// before var ok = isFile(path, throwIfMissing); // after var ok = isFile(path);
Defensive patterns
Strategy: validation
Validate before calling
if (typeof path === 'string' && path.length > 0) {
var ok = isFile(path);
} Type guard
function isNonEmptyString(v) { return typeof v === 'string' && v.length > 0; } Prevention
- Pass exactly one string argument to isFile.
- Do not add extra options/flags — the signature accepts only the path.
- Wrap the call in try-catch: it throws rather than returning false for missing paths.
When it happens
Trigger: Calling isFile() with no arguments, with two or more arguments, or with a null ArgList; the outer catch(Exception) branch also surfaces any other unexpected exception here.
Common situations: Refactorings that added a second parameter, dynamic argument arrays that end up empty, or calls copied from other ScriptAddedFunctions variants with different signatures.
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 copyFileis not valid.
- The function call getFileSize is not valid.
- [ + ArgList[0] + ] is not a file!
- file [ + ArgList[0] + ] can not be found!
- ] is not a file!
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/82d8d041f9e7d89c.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:2161
}
} else {
throw new RuntimeException( "file [" + ArgList[0] + "] can not be found!" );
}
return isafile;
} catch ( IOException e ) {
throw new RuntimeException( "The function call is File throw an error : " + e.toString() );
} finally {
if ( file != null ) {
try {
file.close();
} catch ( Exception e ) {
// Ignore errors
}
}
}
} else {
throw new RuntimeException( "The function call isFile is not valid." );
}
} catch ( Exception e ) {
throw new RuntimeException( e.toString() );
}
}
public static boolean isFolder( Bowl bowl, ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,
Object FunctionContext ) {
try {
if ( ArgList.length == 1 && !isNull( ArgList[0] ) && !isUndefined( ArgList[0] ) ) {
if ( ArgList[0].equals( null ) ) {
return false;
}
FileObject file = null;
try {
// Source file
file = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] );View on GitHub (pinned to f3058517a1)