pentaho/pentaho-kettle · error · RuntimeException

folder [ + ArgList[0] + ] can not be found!

Error message

folder [ + ArgList[0] + ] can not be found!

What it means

Thrown by ScriptAddedFunctions.isFolder() when the VFS file object at ArgList[0] does not exist (file.exists() returns false). The function requires the target to be an existing folder, so a missing or mis-typed directory path produces this RuntimeException instead of returning false.

Solutions

  1. Verify the exact path exists (ls the parent directory) and fix typos or casing.
  2. Create the directory before the call if it is expected to be produced by an earlier step (e.g. mkdir step or file.exists()/createFolder).
  3. Use an absolute path or fix the working directory/base path so the relative path resolves correctly.
  4. Confirm the VFS scheme/host prefix is correct and the share is mounted/connected at runtime.
  5. If a missing folder should be an acceptable outcome, guard with a file-exists check in the script instead of relying on isFolder.

Example fix

// before
var ok = isFolder( "/data/repots" ); // folder can not be found!
// after
var ok = fileExists( "/data/reports" ) && isFolder( "/data/reports" );
Defensive patterns

Strategy: validation

Validate before calling

// pre-check existence in the script
var ok = fileExists(p) ? isFolder(p) : false;

Type guard

function folderPathProvided(p) { return typeof p === "string" && p.trim().length > 0; }

Try / catch

try { ok = isFolder(p); } catch (e) { if (String(e.message).indexOf("can not be found") >= 0) { ok = false; } else { throw e; } }

Prevention

When it happens

Trigger: Calling isFolder(path) with a path that does not exist on the resolved VFS filesystem: wrong directory name, not-yet-created folder, wrong mount/scheme prefix, or case-mismatched path on a case-sensitive filesystem.

Common situations: Environment differences (folder exists on the dev machine but not the server); relative paths resolving against an unexpected base directory; typo'd or renamed directories; network VFS shares not mounted at job runtime.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/c60489ba86db7d81. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/script/ScriptAddedFunctions.java:2188

    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 {
        throw new RuntimeException( "The function call isFolder is not valid." );
      }
    } catch ( Exception e ) {

View on GitHub (pinned to f3058517a1)