pentaho/pentaho-kettle · error · RuntimeException
The function call getFileSize is not valid.
Error message
The function call getFileSize is not valid.
What it means
Outer validation error thrown by ScriptAddedFunctions.getFileSize when the argument list has an invalid shape. The function expects exactly one argument (the file path); any other count makes the call 'not valid'. The outer catch (Exception e) also rethrows any other failure as e.toString() at the same site.
Solutions
- Call getFileSize with exactly one string path argument.
- Remove any extra arguments added to the call.
- If the message is e.toString() instead, inspect that string for the underlying exception cause.
Example fix
// before var size = getFileSize(path, 'bytes'); // after var size = getFileSize(path);
Defensive patterns
Strategy: validation
Validate before calling
if (typeof path === 'string' && path.length > 0) {
var size = getFileSize(path);
} Type guard
function isNonEmptyString(v) { return typeof v === 'string' && v.length > 0; } Prevention
- Pass exactly one argument to getFileSize.
- Convert fields to strings before passing them.
When it happens
Trigger: Calling getFileSize with zero arguments or more than one argument, e.g. getFileSize() or getFileSize(path, extra); the outer catch also surfaces any unexpected exception here as its toString().
Common situations: Copy-paste from a two-argument variant, refactorings that added an options parameter not supported by this function, or calling getFileSize with a null first argument.
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 isFile 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/11ec7fdd2a8887a8.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:2118
}
} else {
throw new RuntimeException( "file [" + ArgList[0] + "] can not be found!" );
}
return filesize;
} catch ( IOException e ) {
throw new RuntimeException( "The function call getFileSize throw an error : " + e.toString() );
} finally {
if ( file != null ) {
try {
file.close();
} catch ( Exception e ) {
// Ignore errors
}
}
}
} else {
throw new RuntimeException( "The function call getFileSize is not valid." );
}
} catch ( Exception e ) {
throw new RuntimeException( e.toString() );
}
}
public static boolean isFile( 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)