pentaho/pentaho-kettle · error · KettleException

ZipFile.Error.NotAFolder

Error message

ZipFile.Error.NotAFolder

What it means

The ZipFile step throws this when the configured 'move to folder' path exists but is a regular file (or other non-folder VFS object), so the step cannot move processed source files into it. It is thrown from processFile after resolving the folder path via KettleVFS, before moving files, aborting the row processing.

Solutions

  1. Inspect the resolved folder path at runtime and ensure it is a directory (or does not exist, in which case the step creates it).
  2. Remove or rename the regular file that currently occupies the target folder path.
  3. Fix variable/field expressions feeding the movetofolderfield so they resolve to the intended directory path.
  4. Enable 'Create parent folder' (createparentfolder) and use a fresh target directory name so the step creates it itself.

Example fix

// before: target path 'out/archive' is an existing file
// after: remove the conflicting file or point the step at a real directory
rm /data/out/archive   # was a file blocking the folder path
mkdir -p /data/out/archive
Defensive patterns

Strategy: validation

Validate before calling

FileObject folder = KettleVFS.getInstance().getFileObject(path);
if (folder.exists() && folder.getType() != FileType.FOLDER) {
    throw new IllegalArgumentException("Move-to path is not a folder: " + path);
}

Type guard

boolean isFolder(FileObject f) throws FileSystemException {
    return f != null && f.exists() && f.getType() == FileType.FOLDER;
}

Try / catch

try {
    runTransformation(zipFileTrans);
} catch (KettleException e) {
    if (e.getMessage().contains("NotAFolder")) { /* fix/recreate the folder path */ }
    throw e;
}

Prevention

When it happens

Trigger: Running the ZipFile transformation step with a 'move files to folder' setting whose target path points at an existing non-directory file; moveToFolder.exists() is true but getType() != FileType.FOLDER.

Common situations: Typo or stale path in the 'Move/store files in folder' field that collides with an existing file; a variable/field substitution resolving to a file instead of a directory; a cleanup job replaced the folder with a file of the same name.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/zipfile/ZipFile.java:275

      }
    }

    return true;
  }

  private void processFile( String folder ) throws Exception {

    switch ( meta.getOperationType() ) {
      case ZipFileMeta.OPERATION_TYPE_MOVE:
        FileObject file = null;
        FileObject moveToFolder = null;
        try {
          // Move to folder
          moveToFolder = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( folder, this );

          if ( moveToFolder.exists() ) {
            if ( moveToFolder.getType() != FileType.FOLDER ) {
              throw new KettleException( BaseMessages.getString( PKG, "ZipFile.Error.NotAFolder", folder ) );
            }
          } else {
            moveToFolder.createFolder();
          }

          // get target filename
          String targetfilename =
            KettleVFS.getFilename( moveToFolder )
              + Const.FILE_SEPARATOR + data.sourceFile.getName().getBaseName();
          file = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( targetfilename, this );

          // Move file
          data.sourceFile.moveTo( file );

        } finally {
          if ( file != null ) {
            try {
              file.close();

View on GitHub (pinned to f3058517a1)