pentaho/pentaho-kettle · error · RuntimeException
The function call getFileExtension throw an error : +…
Error message
The function call getFileExtension throw an error : + e.toString()
What it means
getFileExtension() wraps any IOException raised while resolving or reading the VFS FileObject into a RuntimeException with this message. Unlike the 'can not be found' variant, the file resolution itself failed at the VFS/IO layer (bad URI, provider error, access problem). The original IOException text is appended.
Solutions
- Check the appended IOException message (e.getMessage) to identify the underlying cause.
- Normalize the path to a forward-slash URI form (file:///C:/data/file.txt on Windows).
- Install/verify the VFS provider plugin for remote schemes (S3, SFTP, etc.).
- Retry if the cause was a transient network error, after fixing connectivity.
- Log the full input argument and surrounding stack trace to confirm which call site threw.
Example fix
// before var ext = getFileExtension( 'C:\\data\\file.txt' ); // backslashes break VFS URI // after var ext = getFileExtension( 'file:///C:/data/file.txt' );
Defensive patterns
Strategy: try-catch
Validate before calling
// ensure URI-safe form 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 ext = getFileExtension(path); } catch (e) { Logger.logError('getFileExtension IO failure: ' + e); var ext = ''; } Prevention
- Use forward slashes and proper file:/// scheme on Windows
- Install required commons-vfs provider plugins for remote schemes
- Validate remote connectivity before long transformation runs
When it happens
Trigger: Calling getFileExtension() with a malformed VFS URI (invalid scheme characters), a scheme with no registered VFS provider, or a resolution/exists() check that throws IOException (e.g. network VFS unreachable, permission issues surfacing as IOException).
Common situations: Windows paths with backslashes or drive letters misinterpreted as URI schemes; s3:// or other remote schemes without the required provider plugin installed; network shares temporarily unavailable during the transformation run.
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 getLastModifiedTime throw an error : +…
- The function call getParentFoldername 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/a9d0c232fd4954e5.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:2274
if ( ArgList[0].equals( null ) ) {
return null;
}
FileObject file = null;
try {
// Source file
file = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] );
String Extension = null;
if ( file.exists() ) {
Extension = file.getName().getExtension();
} else {
throw new RuntimeException( "file [" + ArgList[0] + "] can not be found!" );
}
return Extension;
} catch ( IOException e ) {
throw new RuntimeException( "The function call getFileExtension throw an error : " + e.toString() );
} finally {
if ( file != null ) {
try {
file.close();
} catch ( Exception e ) {
// Ignore errors
}
}
}
} else {
throw new RuntimeException( "The function call getFileExtension is not valid." );
}
} catch ( Exception e ) {
throw new RuntimeException( e.toString() );
}
}
View on GitHub (pinned to f3058517a1)