pentaho/pentaho-kettle · error · RuntimeException
[ + ArgList[0] + ] is not a file!
Error message
[ + ArgList[0] + ] is not a file!
What it means
Thrown by ScriptAddedFunctions.isFile when the resolved VFS object exists but is not a regular file (e.g. it is a directory). Instead of simply returning false, the implementation throws 'is not a file!' when the type check fails on an existing path.
Solutions
- Pass a path you expect to be a regular file; handle directories before calling isFile.
- Strip trailing '/' from directory paths and append the expected filename.
- If you only need existence semantics, check existence separately and treat directories explicitly.
Example fix
// before
var ok = isFile('/data/archive');
// after
var ok = isFile('/data/archive/export.csv'); Defensive patterns
Strategy: validation
Validate before calling
var f = new java.io.File(path);
if (f.exists() && f.isFile()) {
var ok = isFile(path);
} Prevention
- Only pass paths expected to be regular files.
- Strip trailing separators from directory-derived paths.
- Treat isFile as throwing on directories, not returning false.
When it happens
Trigger: Calling isFile('/some/folder') where the path exists in VFS but has type FOLDER instead of FILE.
Common situations: Testing whether a path is a file but pointing at a directory, user-supplied paths that may be folders, or configuration variables containing directory roots.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- ] is not a file!
- file [ + ArgList[0] + ] can not be found!
- The function call getFileSize throw an error :
- The function call is File throw an error : + e.toString()
- AvroInputDialog.Error.KettleFileException
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/5061fa96be4a0606.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:2142
public static boolean isFile( Bowl bowl, ScriptEngine actualContext, Bindings actualObject, Object[] ArgList,
Object FunctionContext ) {
try {
if ( ArgList.length == 1 && !isNull( ArgList[0] ) && !isUndefined( ArgList[0] ) ) {
if ( ArgList[0].equals( null ) ) {
return false;
}
FileObject file = null;
try {
// Source file
file = KettleVFS.getInstance( bowl ).getFileObject( (String) ArgList[0] );
boolean isafile = false;
if ( file.exists() ) {
if ( file.getType().equals( FileType.FILE ) ) {
isafile = true;
} else {
throw new RuntimeException( "[" + ArgList[0] + "] is not a file!" );
}
} else {
throw new RuntimeException( "file [" + ArgList[0] + "] can not be found!" );
}
return isafile;
} catch ( IOException e ) {
throw new RuntimeException( "The function call is File throw an error : " + e.toString() );
} finally {
if ( file != null ) {
try {
file.close();
} catch ( Exception e ) {
// Ignore errors
}
}
}
} else {View on GitHub (pinned to f3058517a1)