{"record":{"id":"5af6655f596e67a9","repo":"pentaho/pentaho-kettle","slug":"reportexporttask-parent-folder-does-not-exist","errorCode":null,"errorMessage":"ReportExportTask.PARENT_FOLDER_DOES_NOT_EXIST","messagePattern":"ReportExportTask\\.PARENT_FOLDER_DOES_NOT_EXIST","errorType":"exception","errorClass":"ReportProcessingException","httpStatus":null,"severity":"error","filePath":"plugins/pentaho-reporting/impl/src/main/java/org/pentaho/di/trans/steps/pentahoreporting/ReportExportTask.java","lineNumber":83,"sourceCode":"   * the object's <code>run</code> method to be called in that separately executing thread.\n   * <p/>\n   * The general contract of the method <code>run</code> is that it may take any action whatsoever.\n   *\n   * @see Thread#run()\n   */\n  public void run() {\n    try {\n      targetFile = KettleVFS.getInstance( bowl ).getFileObject( targetPath );\n      if ( targetFile.exists() ) {\n        if ( !targetFile.delete() ) {\n          throw new ReportProcessingException( BaseMessages.getString( PKG, \"ReportExportTask.ERROR_0001_TARGET_EXISTS\" ) );\n        }\n      }\n\n      if ( createParentFolder ) {\n        targetFile.getParent().createFolder();\n      } else if ( !targetFile.getParent().exists() ) {\n        throw new ReportProcessingException( BaseMessages.getString( PKG,\n          \"ReportExportTask.PARENT_FOLDER_DOES_NOT_EXIST\", targetFile.getParent().getName().getPath() ) );\n      }\n\n      execute();\n    } catch ( Exception ex ) {\n      statusListener.setStatus( StatusType.ERROR, BaseMessages.getString( PKG,  \"ReportExportTask.USER_EXPORT_FAILED\" ), ex );\n      logger.error( BaseMessages.getString( PKG, \"ReportExportTask.ERROR.GenerationFailed\", targetPath ) );\n    }\n  }\n\n  protected void execute() throws Exception {\n    BufferedOutputStream fout = null;\n    ReportProcessor reportProcessor = null;\n    try {\n      fout = new BufferedOutputStream( targetFile.getContent().getOutputStream() );\n      reportProcessor = createReportProcessor( fout );\n      reportProcessor.processReport();\n      statusListener.setStatus( StatusType.INFORMATION, BaseMessages.getString( PKG, \"ReportExportTask.USER_EXPORT_COMPLETE\" ), ","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/pentaho-reporting/impl/src/main/java/org/pentaho/di/trans/steps/pentahoreporting/ReportExportTask.java#L65-L101","documentation":"ReportExportTask.run() throws ReportProcessingException with ReportExportTask.PARENT_FOLDER_DOES_NOT_EXIST when createParentFolder is false and the target file's parent directory does not exist. The export task refuses to write the report because it has nowhere to put it; the failure is then reported via the status listener with USER_EXPORT_FAILED.","triggerScenarios":"createParentFolder flag unchecked in the step and targetFile.getParent().exists() returns false at run() time, right before execute().","commonSituations":"Target filename includes a directory that was never created (e.g. /out/reports/report.pdf with /out/reports missing); variable substitution produced a wrong base path; job changed working directory relative to a relative target path.","solutions":["Enable the 'Create parent folder' option in the Pentaho Reporting Output step","Create the target directory before running the transformation","Use ${Internal.Transformation.Filename.Directory} or absolute paths to build a correct target directory","Check variable values with a 'Get Variables' step or logging to confirm the resolved path"],"exampleFix":"// before\nelse if ( !targetFile.getParent().exists() ) {\n  throw new ReportProcessingException(...);\n}\n// after — caller-side alternative: always create parents\nexportTask.setCreateParentFolder( true ); // checkbox: Create parent folder","handlingStrategy":"validation","validationCode":"FileObject target = KettleVFS.getInstance( bowl ).getFileObject( targetPath );\nFileObject parent = target.getParent();\nif ( !parent.exists() ) {\n  parent.createFolder(); // or fail fast with a clear message\n}","typeGuard":null,"tryCatchPattern":"try {\n  exportTask.run();\n} catch ( ReportProcessingException e ) {\n  if ( e.getMessage().contains( \"PARENT_FOLDER_DOES_NOT_EXIST\" ) ) {\n    logError( \"Missing output folder for \" + targetPath );\n  }\n}","preventionTips":["Enable 'Create parent folder' in the step settings","Log resolved variables to verify the target directory path","Create output directories in an earlier job entry","Prefer absolute paths over relative ones in scheduled jobs"],"tags":["vfs","file-io","configuration"],"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"}