{"record":{"id":"a021e65404039008","repo":"pentaho/pentaho-kettle","slug":"jobwritetofile-error-checkingparentfolder","errorCode":null,"errorMessage":"JobWriteToFile.Error.CheckingParentFolder","messagePattern":"JobWriteToFile\\.Error\\.CheckingParentFolder","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/job/entries/writetofile/JobEntryWriteToFile.java","lineNumber":261,"sourceCode":"      parent = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( realFilename, this ).getParent();\n      if ( !parent.exists() ) {\n        if ( isCreateParentFolder() ) {\n          if ( isDetailed() ) {\n            logDetailed( BaseMessages.getString( PKG, \"JobWriteToFile.Log.ParentFoldetNotExist\", parent\n              .getName().toString() ) );\n          }\n          parent.createFolder();\n          if ( isDetailed() ) {\n            logDetailed( BaseMessages.getString( PKG, \"JobWriteToFile.Log.ParentFolderCreated\", parent\n              .getName().toString() ) );\n          }\n        } else {\n          throw new KettleException( BaseMessages.getString(\n            PKG, \"JobWriteToFile.Log.ParentFoldetNotExist\", parent.getName().toString() ) );\n        }\n      }\n    } catch ( Exception e ) {\n      throw new KettleException( BaseMessages.getString(\n        PKG, \"JobWriteToFile.Error.CheckingParentFolder\", realFilename ), e );\n    } finally {\n      if ( parent != null ) {\n        try {\n          parent.close();\n        } catch ( Exception e ) { /* Ignore */\n        }\n      }\n    }\n  }\n\n  public boolean evaluates() {\n    return true;\n  }\n\n  public boolean isAppendFile() {\n    return appendFile;\n  }","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/job/entries/writetofile/JobEntryWriteToFile.java#L243-L279","documentation":"KettleException with message key JobWriteToFile.Error.CheckingParentFolder thrown by JobEntryWriteToFile.createParentFolder as a catch-all wrapper: any exception raised while checking or creating the file's parent folder (including the ParentFoldetNotExist throw) is re-wrapped with the target filename and chained as the cause. It signals the entry could not verify/prepare the output directory.","triggerScenarios":"Executing the entry when parent folder existence check or creation throws any Exception — e.g. KettleFileException from resolve of an invalid VFS path, security/IO errors, or the inner ParentFoldetNotExist error.","commonSituations":"Invalid or unreachable file paths (bad VFS scheme like sftp:// misconfigured); permission errors on the directory; missing parent folders; OS-specific path errors.","solutions":["Read the chained cause to find the root failure (missing folder vs IO/permission)","Fix the filename/path and ensure the parent directory exists or 'create parent folder' is enabled","Verify the OS user can write to the target directory","Test the path in Spoon locally before running on a server"],"exampleFix":"// before\nString filename = \"sftp://badhost/data/out.txt\"; // unresolvable path -> throws\n// after\nString filename = \"/data/out/out.txt\"; // valid local path, parent exists\nnew File(\"/data/out\").mkdirs();","handlingStrategy":"try-catch","validationCode":"// verify path resolvable and parent writable before execute\nFile out = new File(filename);\nif (!out.getAbsoluteFile().getParentFile().canWrite()) {\n  throw new IllegalStateException(\"Output directory not writable: \" + out.getParent());\n}","typeGuard":null,"tryCatchPattern":"try {\n  entry.execute(prev, nr);\n} catch (KettleException e) {\n  Throwable root = e;\n  while (root.getCause() != null) root = root.getCause();\n  logError(\"Checking parent folder failed for \" + filename + \": \" + root.getMessage(), e);\n}","preventionTips":["Always inspect the chained cause to distinguish path errors from permission errors","Validate VFS paths/schemes before deploying jobs","Pre-create directories and grant write permissions to the service account","Test entry execution locally before server deployment"],"tags":["kettle","filesystem","directory","job-entry"],"backgroundTag":"directory-not-found","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}