pentaho/pentaho-kettle · error · RuntimeException
The function call getShortFilename throw an error : +…
Error message
The function call getShortFilename throw an error : + e.toString()
What it means
This is the IOException handler of ScriptAddedFunctions.getShortFilename(): failures resolving or inspecting the VFS FileObject (KettleVFS.getFileObject, file.exists(), getName()) are re-thrown as RuntimeException with the message 'The function call getShortFilename throw an error : ' plus e.toString(). It indicates an I/O or transport problem rather than a simple 'file missing' condition.
Solutions
- Inspect the appended e.toString() for the concrete IOException (unknown host, auth failure, malformed URI) and fix that cause.
- Validate/encode the VFS URL (escape spaces and special chars) before calling.
- Check remote connectivity and credentials; add a retry step for transient network errors.
- Catch the RuntimeException in the JavaScript step to log and skip bad rows.
- Fall back to computing the short name locally (substring after last '/' or '\\') when only the name is needed and the file cannot be inspected.
Example fix
// before var name = getShortFilename( "/data/my file.txt" ); // unescaped space -> IOException // after var name = getShortFilename( "file:///data/my%20file.txt" );
Defensive patterns
Strategy: try-catch
Validate before calling
// sanity-check the path/URL before the call
if ( typeof p === "string" && p.length > 0 && p.indexOf(" ") < 0 ) { name = getShortFilename(p); } Type guard
function isPlainPath(v) { return typeof v === "string" && /^[A-Za-z0-9_\-.:\/\\]+$/.test(v); } Try / catch
try { name = getShortFilename(p); } catch (e) { var m = String(e.message); if (m.indexOf("throw an error") >= 0) { Logger.logError("getShortFilename IO: " + m); } } Prevention
- Escape special characters in VFS URLs.
- Verify remote host reachability and credentials before batch runs.
- Implement retries for transient network errors.
- Compute the base name locally when only the name is needed and inspection is not required.
When it happens
Trigger: Calling getShortFilename(path) when the VFS layer throws IOException: unreachable SFTP/HTTP host, invalid VFS URI, network failure mid-call, or permission/IO errors reading the file's metadata.
Common situations: Remote files over sftp/webdav whose server is down or credentials expired; paths with unescaped spaces/special characters producing malformed URIs; transient network drops during large batch 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 isFolder throw an error : + e.toString()
- 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/8d6014de9035aaa2.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:2233
if ( ArgList[0].equals( null ) ) {
return null;
}
FileObject file = null;
try {
// Source file
file = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] );
String Filename = null;
if ( file.exists() ) {
Filename = file.getName().getBaseName();
} else {
throw new RuntimeException( "file [" + ArgList[0] + "] can not be found!" );
}
return Filename;
} catch ( IOException e ) {
throw new RuntimeException( "The function call getShortFilename throw an error : " + e.toString() );
} finally {
if ( file != null ) {
try {
file.close();
} catch ( Exception e ) {
// Ignore errors
}
}
}
} else {
throw new RuntimeException( "The function call getShortFilename is not valid." );
}
} catch ( Exception e ) {
throw new RuntimeException( e.toString() );
}
}
View on GitHub (pinned to f3058517a1)