pentaho/pentaho-kettle · error · RuntimeException
[ + ArgList[0] + ] is not a folder!
Error message
[ + ArgList[0] + ] is not a folder!
What it means
Thrown by ScriptAddedFunctions.isFolder() when the VFS object at ArgList[0] exists but its FileType is not FileType.FOLDER — i.e. the caller passed a regular file where a directory was expected. The function resolves the path via KettleVFS, confirms it exists, then validates the type; a file (or other non-folder type) fails the check and aborts with this RuntimeException.
Solutions
- Check the path with isFile()/ls and confirm whether it is a file; remove or rename the file if the directory was intended.
- Correct the path passed to isFolder() to point at an actual directory (add the missing path segment or trailing name).
- If the path may be either, branch in the script: if(isFile(p)) {...} else if(isFolder(p)) {...}.
- Create the intended directory first (mkdir) if it does not exist and the file is unrelated.
- Validate the path ends at a directory before calling, e.g. via Java Files.isDirectory() or a KettleVFS type check.
Example fix
// before var ok = isFolder( "/data/report.txt" ); // throws: [/data/report.txt] is not a folder! // after var ok = isFolder( "/data/reports" ); // existing directory
Defensive patterns
Strategy: validation
Validate before calling
// before calling var f = getFileSize(p); // or isFile(p); confirm p points to a directory before isFolder(p)
Type guard
function looksLikeDirectory(p) { return typeof p === "string" && !/\.[A-Za-z0-9]+$/.test(p); } Try / catch
try { ok = isFolder(p); } catch (e) { if (String(e.message).indexOf("not a folder") >= 0) { /* handle file-instead-of-folder */ } else { throw e; } } Prevention
- Verify with isFile() that the path is not a file before calling isFolder().
- Avoid free-text folder inputs; use folder-browser validated config fields.
- Watch for files accidentally created at the same path as the intended folder.
- Document that isFolder throws rather than returning false for wrong-type paths.
When it happens
Trigger: Calling isFolder(path) from a JavaScript step with a path that resolves to an existing regular file (e.g. /data/report.txt) instead of a directory.
Common situations: Typos dropping the trailing directory name so the path points at a file; config fields where the user entered a file path in a 'folder' input; VFS symlinks or name collisions where a file was created where a folder was expected.
Related errors
- folder [ + ArgList[0] + ] can not be found!
- Error opening new file
- failed to check isFile in setPath()
- GPG.ErrorCheckingGPGFile
- JobGetMailsFromPOP.Error.AttachmentFolderNotAFolder
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/f704894cd9fd5d75.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:2185
public static boolean isFolder( 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 isafolder = false;
if ( file.exists() ) {
if ( file.getType().equals( FileType.FOLDER ) ) {
isafolder = true;
} else {
throw new RuntimeException( "[" + ArgList[0] + "] is not a folder!" );
}
} else {
throw new RuntimeException( "folder [" + ArgList[0] + "] can not be found!" );
}
return isafolder;
} catch ( IOException e ) {
throw new RuntimeException( "The function call isFolder throw an error : " + e.toString() );
} finally {
if ( file != null ) {
try {
file.close();
} catch ( Exception e ) {
// Ignore errors
}
}
}
} else {View on GitHub (pinned to f3058517a1)