pentaho/pentaho-kettle · error · RuntimeException
The function call getParentFoldername throw an error : +…
Error message
The function call getParentFoldername throw an error : + e.toString()
What it means
getParentFoldername() wraps any IOException from VFS resolution or from file.getParent() into this RuntimeException, appending e.toString(). The argument was syntactically acceptable but the VFS layer failed to resolve or query it.
Solutions
- Inspect the appended IOException text for the root cause.
- Convert the path to a proper URI (forward slashes, escaped spaces) or use file:/// scheme.
- Install the needed VFS plugin for the scheme; verify remote credentials/connectivity.
- Add retry logic around the transformation or step for transient network errors.
- Fall back to pure-JS string manipulation (substring(0, lastIndexOf('/'))) when only the path string is needed.
Example fix
// before
var dir = getParentFoldername( 'sftp://user:pw@host/path/file.txt' ); // IOException if unreachable
// after
try {
var dir = getParentFoldername( 'sftp://user:pw@host/path/file.txt' );
} catch (e) {
var dir = filename.substring( 0, filename.lastIndexOf('/') );
} Defensive patterns
Strategy: try-catch
Validate before calling
var uri = String(path).replace(/\\/g, '/');
if (/^[A-Za-z]:/.test(uri)) { uri = 'file:///' + uri; } Type guard
function isUriLike(v){ return typeof v === 'string' && /^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(v); } Try / catch
try { var dir = getParentFoldername(path); } catch (e) { Logger.logError('getParentFoldername IO failure: ' + e); var dir = String(path).substring(0, String(path).lastIndexOf('/')); } Prevention
- Normalize paths to VFS URI form before calling
- Verify VFS plugins and remote credentials up front
- Prefer plain string manipulation when only the path text is needed
- Retry transformations on transient network backends
When it happens
Trigger: Malformed VFS URI (bad scheme, unescaped characters); file.getParent() throwing IOException on some providers; remote VFS (SFTP/S3) unreachable or credentials failing mid-run.
Common situations: Windows backslash paths parsed as URI scheme; missing commons-vfs provider for a custom scheme; transient network failures during long-running transformations.
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 getFileExtension throw an error : +…
- The function call getLastModifiedTime throw an error : +…
- [ + 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/116dc3a6e49dd425.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:2316
if ( ArgList[0].equals( null ) ) {
return null;
}
FileObject file = null;
try {
// Source file
file = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] );
String foldername = null;
if ( file.exists() ) {
foldername = KettleVFS.getFilename( file.getParent() );
} else {
throw new RuntimeException( "file [" + ArgList[0] + "] can not be found!" );
}
return foldername;
} catch ( IOException e ) {
throw new RuntimeException( "The function call getParentFoldername throw an error : " + e.toString() );
} finally {
if ( file != null ) {
try {
file.close();
} catch ( Exception e ) {
// Ignore errors
}
}
}
} else {
throw new RuntimeException( "The function call getParentFoldername is not valid." );
}
} catch ( Exception e ) {
throw new RuntimeException( e.toString() );
}
}
View on GitHub (pinned to f3058517a1)