pentaho/pentaho-kettle · error
The function call getParentFoldername throw an error :
Error message
The function call getParentFoldername throw an error :
What it means
getParentFoldername() returns the parent folder of the file identified by its single argument via KettleVFS. If a java.io.IOException is thrown while resolving or inspecting the VFS object, the function converts it to a JavaScript runtime error: 'The function call getParentFoldername throw an error : ' plus the exception message. This indicates a filesystem/VFS-level failure rather than a scripting mistake.
Solutions
- Validate the path is a resolvable VFS URI before calling
- Check the remote filesystem availability and credentials
- Normalize relative paths to fully qualified URIs
- Update/align commons-vfs and provider libraries
Example fix
// before
var parent = getParentFoldername('sftp://host/dir with space/f.txt');
// after
var parent = getParentFoldername('sftp://host/dir%20with%20space/f.txt'); Defensive patterns
Strategy: try-catch
Validate before calling
var f = isFile(path); // fail fast on unresolvable URIs
Type guard
function isVfsUri(v) { return typeof v === 'string' && v.indexOf('://') > 0; } Try / catch
try { var p = getParentFoldername(path); } catch (e) {
// 'getParentFoldername throw an error : <IOException>'
p = null; } Prevention
- Use properly encoded, fully qualified URIs
- Monitor remote filesystem health before runs
- Escape special characters
- Keep VFS provider dependencies current
When it happens
Trigger: KettleVFS.getFileObject() or file operations throwing IOException — malformed or unsupported VFS URI, unreachable network filesystem, provider resolution failure, or I/O errors during resolution/close.
Common situations: SFTP/SMB mounts down or credentials expired, special characters not URL-encoded in paths, wrong URI scheme, commons-vfs provider version incompatibilities.
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 getShortFilename throw an error :
- The function call isFolder throw an error :
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/367d1a8d58d80f48.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:2404
if ( ArgList[0].equals( null ) ) {
return null;
}
FileObject file = null;
try {
// Source file
file = KettleVFS.getInstance( getBowl( actualObject ) ).getFileObject( Context.toString( ArgList[0] ) );
String foldername = null;
if ( file.exists() ) {
foldername = KettleVFS.getFilename( file.getParent() );
} else {
Context.reportRuntimeError( "file [" + Context.toString( ArgList[0] ) + "] can not be found!" );
}
return foldername;
} catch ( IOException e ) {
throw Context.reportRuntimeError( "The function call getParentFoldername throw an error : "
+ e.toString() );
} finally {
if ( file != null ) {
try {
file.close();
} catch ( Exception e ) {
// Ignore errors
}
}
}
} else {
throw Context.reportRuntimeError( "The function call getParentFoldername is not valid." );
}
} catch ( Exception e ) {
throw Context.reportRuntimeError( e.toString() );
}
}View on GitHub (pinned to f3058517a1)