pentaho/pentaho-kettle · error · KettleException

ZipFile.Error.TargetParentFolderNotExists

Error message

ZipFile.Error.TargetParentFolderNotExists

What it means

The zip target file's parent folder does not exist and the 'create parent folder' option is disabled, so the step fails instead of silently creating directories. This protects users from accidentally creating unintended directory trees when the target path is wrong.

Solutions

  1. Enable 'Create parent folder' in the ZipFile step settings so missing directories are created automatically.
  2. Create the target directory in advance with a 'Create a folder' step or shell script.
  3. Verify the target filename/path is correct if the missing folder is unexpected.
  4. Check filesystem permissions if folder creation is expected to have happened.

Example fix

// before
meta.setCreateParentFolder(false);
// after
meta.setCreateParentFolder(true);
Defensive patterns

Strategy: validation

Validate before calling

// Before execution, ensure the target directory exists or auto-create is enabled
if (!zipFileMeta.isCreateParentFolder()) {
  File parent = new File(targetFilename).getParentFile();
  if (parent != null && !parent.exists()) {
    parent.mkdirs(); // or fail fast with a clear message
  }
}

Try / catch

try {
  transformation.execute();
} catch (KettleException e) {
  if (e.getMessage() != null && e.getMessage().contains("TargetParentFolderNotExists")) {
    log.error("ZipFile target parent folder missing: enable 'create parent folder' or mkdir first", e);
  } else { throw e; }
}

Prevention

When it happens

Trigger: data.zipFile.getParent().exists() is false and meta.isCreateParentFolder() is false at ZipFile.java:203; thrown before writing the archive.

Common situations: Target path includes a new subdirectory that was never created (e.g., per-date folders like /out/2026/09/); typo in the target path so an unintended nonexistent folder is referenced; running on a fresh environment where the output tree was not provisioned; permissions prevented an earlier mkdir.

Related errors


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

Appendix: source

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

        if ( Utils.isEmpty( targetFilename ) ) {
          log.logError( toString(), BaseMessages.getString( PKG, "ZipFile.Error.TargetFileEmpty" ) );
          throw new KettleException( BaseMessages.getString( PKG, "ZipFile.Error.TargetFileEmpty" ) );
        }
        data.zipFile = KettleVFS.getInstance( getTransMeta().getBowl() ).getFileObject( targetFilename, this );
        if ( data.zipFile.exists() ) {
          if ( log.isDetailed() ) {
            log.logDetailed( toString(), BaseMessages.getString(
              PKG, "ZipFile.Log.TargetFileExists", targetFilename ) );
          }
        } else {
          // let's check parent folder
          FileObject parentFolder = data.zipFile.getParent();
          if ( !parentFolder.exists() ) {
            if ( !meta.isCreateParentFolder() ) {
              // Parent folder not exist
              // So we will fail
              throw new KettleException( BaseMessages.getString(
                PKG, "ZipFile.Error.TargetParentFolderNotExists", parentFolder.toString() ) );
            } else {
              // Create parent folder
              parentFolder.createFolder();
            }
          }
          if ( parentFolder != null ) {
            parentFolder.close();
          }
        }

        // Let's zip
        zipFile();

        // file was zipped, let's see if we need to move or delete it
        processFile( moveToFolder );

        // add filename to result filenames?

View on GitHub (pinned to f3058517a1)