pentaho/pentaho-kettle · error · RuntimeException
The function call isFolder throw an error : + e.toString()
Error message
The function call isFolder throw an error : + e.toString()
What it means
This is the IOException handler of ScriptAddedFunctions.isFolder(): any failure while resolving or reading the VFS FileObject (KettleVFS.getFileObject or file.exists()/getType()) is re-thrown as RuntimeException with the prefix 'The function call isFolder throw an error : ' followed by e.toString(). It signals an I/O-level problem (not a logical 'folder missing' condition) while accessing the path.
Solutions
- Read the appended e.toString() to identify the underlying IOException cause (connection refused, unknown host, malformed URI, etc.).
- Validate the VFS URL format/scheme and encode special characters in the path before calling.
- Test connectivity/credentials to the remote filesystem; retry once connectivity is restored.
- Run the step with more verbose logging or catch the RuntimeException in the JavaScript step to inspect the message.
- Fix root cause rather than swallowing: e.g. correct the VFS provider configuration.
Example fix
// before
var ok = isFolder( someUserUrl ); // may throw: The function call isFolder throw an error : ...
// after
try {
var ok = isFolder( encodeURI( someUserUrl ) );
} catch ( ex ) {
Logger.logError( "isFolder IO problem: " + ex.message );
} Defensive patterns
Strategy: try-catch
Validate before calling
// validate the VFS URL shape before calling
if ( /^[a-z]+:\/\//.test(p) || p.indexOf("/") === 0 ) { /* plausible path */ } Type guard
function isValidVfsPath(p) { return typeof p === "string" && p.trim().length > 0 && !/["<>|]/.test(p); } Try / catch
try { ok = isFolder(p); } catch (e) { var m = String(e.message); if (m.indexOf("throw an error") >= 0) { Logger.logError("VFS IO: " + m); /* retry or fail row */ } } Prevention
- Encode spaces and special characters in VFS URLs.
- Monitor remote filesystem availability and credentials before long runs.
- Add retry logic for transient network failures.
- Test the exact VFS scheme (sftp://, http://, file://) in isolation first.
When it happens
Trigger: Calling isFolder(path) when KettleVFS.getFileObject or exists()/getType() throws IOException — unreachable remote host, invalid URI/scheme, network interruption, or filesystem permission/IO errors.
Common situations: Malformed VFS URLs (bad scheme like 'file:/path with spaces' unescaped); SFTP/HTTP VFS servers down or credentials changed; network partitions during a long-running transformation; disk errors.
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 getShortFilename throw an error : +…
- KettleException( e )
- Unable to get VFS File object for filename '
- [ + ArgList[0] + ] is not a folder!
- Error opening new file
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/25974453d2fdf269.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:2192
}
FileObject file = null;
try {
// Source file
file = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] );
boolean isafolder = false;
if ( file.exists() ) {
if ( file.getType().equals( FileType.FOLDER ) ) {
isafolder = true;
} else {
throw new RuntimeException( "[" + ArgList[0] + "] is not a folder!" );
}
} else {
throw new RuntimeException( "folder [" + ArgList[0] + "] can not be found!" );
}
return isafolder;
} catch ( IOException e ) {
throw new RuntimeException( "The function call isFolder throw an error : " + e.toString() );
} finally {
if ( file != null ) {
try {
file.close();
} catch ( Exception e ) {
// Ignore errors
}
}
}
} else {
throw new RuntimeException( "The function call isFolder is not valid." );
}
} catch ( Exception e ) {
throw new RuntimeException( e.toString() );
}
}
View on GitHub (pinned to f3058517a1)