pentaho/pentaho-kettle · error · RuntimeException
The function call getFileSize throw an error :
Error message
The function call getFileSize throw an error :
What it means
Thrown by ScriptAddedFunctions.getFileSize when an IOException occurs while resolving or reading the file through KettleVFS. The original IOException is swallowed and rethrown as a RuntimeException whose message is the string form of the exception, prefixed with 'The function call getFileSize throw an error : '.
Solutions
- Read the wrapped exception text after the prefix to identify the real IOException cause.
- Check file read permissions and that the VFS URI scheme/credentials are correct.
- Retry the transformation if the cause was a transient network failure on a remote filesystem.
- Pre-resolve the file with a KettleVFS-compatible path (no unescaped spaces/special characters).
Defensive patterns
Strategy: try-catch
Validate before calling
var f = new java.io.File(path);
if (f.exists() && f.canRead()) {
var size = getFileSize(path);
} Try / catch
try {
size = getFileSize(path);
} catch (e) {
// message is 'The function call getFileSize throw an error : ' + cause
Logger.logError('getFileSize failed: ' + e.message);
} Prevention
- Check read permissions on the file before calling.
- Escape special characters in VFS URIs.
- Prefer local paths when remote VFS providers are unstable.
When it happens
Trigger: KettleVFS.getFileObject or file.getContent() throws IOException: unreadable permission, closed/broken remote connection, malformed VFS URI, or I/O failure while reading content size.
Common situations: SFTP/HTTP VFS connection dropped mid-read, malformed URI with special characters, permissions revoked after the path check, or transient network failures on remote filesystems.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- The function call is File throw an error : + e.toString()
- [ + ArgList[0] + ] is not a file!
- Error opening new 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/4e5801777b458c14.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:2106
}
FileObject file = null;
try {
// Source file
file = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] );
long filesize = 0;
if ( file.exists() ) {
if ( file.getType().equals( FileType.FILE ) ) {
filesize = file.getContent().getSize();
} else {
throw new RuntimeException( "[" + ArgList[0] + "] is not a file!" );
}
} 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() );
}
}
View on GitHub (pinned to f3058517a1)