pentaho/pentaho-kettle · error
The function call isFolder throw an error :
Error message
The function call isFolder throw an error :
What it means
isFolder() resolves its argument via KettleVFS to a FileObject and tests whether it is a folder. If a java.io.IOException occurs while resolving or reading the VFS object (the underlying filesystem layer fails), the function rethrows it as a JavaScript runtime error prefixed 'The function call isFolder throw an error : '. This is an I/O-layer failure, distinct from the argument-validation error of the same function.
Solutions
- Verify the path is a valid, fully-qualified VFS URI (correct scheme, escaped special characters)
- Check the target filesystem (network share/SFTP server) is reachable and credentials are correct
- Run the path through a simpler call like isFile() to isolate whether VFS resolution itself fails
- Upgrade/align commons-vfs and provider libraries if the scheme is genuinely supported
Example fix
// before
var isDir = isFolder('/data/ reports'); // space breaks URI parsing
// after
var isDir = isFolder('file:///data/%20reports'); // or sanitize the path Defensive patterns
Strategy: try-catch
Validate before calling
// pre-check reachability in script var f = isFile(path); // returns false or throws per type; existence errors surface here
Type guard
function isProbablyVfsUri(v) { return typeof v === 'string' && /^[a-z]+:\/\//.test(v); } Try / catch
try { var d = isFolder(path); } catch (e) {
// e contains 'isFolder throw an error : <IOException>' — treat as unavailable
d = false; } Prevention
- Use fully qualified VFS URIs with correct scheme
- Escape spaces/special characters in paths
- Verify remote filesystem connectivity/credentials in job setup
- Keep commons-vfs and provider libraries up to date
When it happens
Trigger: KettleVFS.getFileObject(path) or file.exists()/getType() throws IOException — e.g. an unsupported or malformed VFS URI scheme, network filesystem unreachable, permission/lock issues during resolution, or closing errors on the underlying resource.
Common situations: Wrong URI scheme (missing sftp://, s3:// prefix) so VFS picks the wrong provider; an SFTP/SMB/network share that is down or unreachable; a path string containing characters that break URI parsing; VFS provider (jsch/commons-vfs) version problems.
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
- Error opening new file
- The function call getFileExtension throw an error :
- The function call getLastModifiedTime throw an error :
- The function call getParentFoldername throw an error :
- The function call getShortFilename throw an error :
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/a44969a83b4e2ec2.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:2281
}
FileObject file = null;
try {
// Source file
file = KettleVFS.getInstance( getBowl( actualObject ) ).getFileObject( Context.toString( ArgList[0] ) );
boolean isafolder = false;
if ( file.exists() ) {
if ( file.getType().equals( FileType.FOLDER ) ) {
isafolder = true;
} else {
Context.reportRuntimeError( "[" + Context.toString( ArgList[0] ) + "] is not a folder!" );
}
} else {
Context.reportRuntimeError( "folder [" + Context.toString( ArgList[0] ) + "] can not be found!" );
}
return isafolder;
} catch ( IOException e ) {
throw Context.reportRuntimeError( "The function call isFolder throw an error : " + e.toString() );
} finally {
if ( file != null ) {
try {
file.close();
} catch ( Exception e ) {
// Ignore errors
}
}
}
} else {
throw Context.reportRuntimeError( "The function call isFolder is not valid." );
}
} catch ( Exception e ) {
throw Context.reportRuntimeError( e.toString() );
}
}
View on GitHub (pinned to f3058517a1)