pentaho/pentaho-kettle · error · KettleException

JobWriteToFile.Log.ParentFoldetNotExist

Error message

JobWriteToFile.Log.ParentFoldetNotExist

What it means

KettleException with message key JobWriteToFile.Log.ParentFoldetNotExist thrown by JobEntryWriteToFile.createParentFolder when the file's parent folder does not exist, folder creation was not requested (createParentFolder=false) or the attempt to create it failed (e.g. FileObject.createFolder threw, caught upstream and reported here via CheckingParentFolder wrap only in outer catch... specifically this inner throw means the parent is not creatable/existing). The folder path is included in the message.

Solutions

  1. Create the missing parent directory manually or fix the filename path
  2. Enable the 'Create parent folder' option in the job entry
  3. Check OS user permissions on the target directory
  4. Use absolute paths to avoid surprises from the process working directory

Example fix

// before
String filename = "/data/out/report.txt"; // /data/out missing, throws
// after
new File("/data/out").mkdirs();
String filename = "/data/out/report.txt";
Defensive patterns

Strategy: validation

Validate before calling

// before execute
File out = new File(filename);
File parent = out.getAbsoluteFile().getParentFile();
if (parent == null || (!parent.exists() && !createParentFolder)) {
  throw new IllegalStateException("Parent folder missing and createParentFolder disabled: " + parent);
}

Try / catch

try {
  entry.execute(prev, nr);
} catch (KettleException e) {
  logError("Parent folder problem for " + filename + ": " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: Executing the Write to File job entry where the target filename's parent directory does not exist and cannot be created — createParentFolder is enabled but createFolder fails or the parent still does not exist after the attempt.

Common situations: Typo in the output directory path; running on an OS with different path separators; job running as a user without write permission on the parent; relative paths resolving against an unexpected working directory when run on a server/cluster.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/job/entries/writetofile/JobEntryWriteToFile.java:256

  }

  private void createParentFolder( String realFilename ) throws KettleException {
    FileObject parent = null;
    try {
      parent = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realFilename, this ).getParent();
      if ( !parent.exists() ) {
        if ( isCreateParentFolder() ) {
          if ( isDetailed() ) {
            logDetailed( BaseMessages.getString( PKG, "JobWriteToFile.Log.ParentFoldetNotExist", parent
              .getName().toString() ) );
          }
          parent.createFolder();
          if ( isDetailed() ) {
            logDetailed( BaseMessages.getString( PKG, "JobWriteToFile.Log.ParentFolderCreated", parent
              .getName().toString() ) );
          }
        } else {
          throw new KettleException( BaseMessages.getString(
            PKG, "JobWriteToFile.Log.ParentFoldetNotExist", parent.getName().toString() ) );
        }
      }
    } catch ( Exception e ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "JobWriteToFile.Error.CheckingParentFolder", realFilename ), e );
    } finally {
      if ( parent != null ) {
        try {
          parent.close();
        } catch ( Exception e ) { /* Ignore */
        }
      }
    }
  }

  public boolean evaluates() {
    return true;

View on GitHub (pinned to f3058517a1)