{"record":{"id":"c50a1b19e0f80f15","repo":"pentaho/pentaho-kettle","slug":"jsonoutput-error-errorcreatingparentfolder","errorCode":"JsonOutput.Error.ErrorCreatingParentFolder","errorMessage":"JsonOutput.Error.ErrorCreatingParentFolder","messagePattern":"JsonOutput\\.Error\\.ErrorCreatingParentFolder","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsonoutput/JsonOutput.java","lineNumber":338,"sourceCode":"      return;\n    }\n    // Check for parent folder\n    FileObject parentfolder = null;\n    try {\n      // Get parent folder\n      parentfolder = KettleVFS.getInstance( getTransMeta().getBowl() )\n        .getFileObject( filename, getTransMeta() ).getParent();\n      if ( !parentfolder.exists() ) {\n        if ( log.isDebug() ) {\n          logDebug( BaseMessages.getString( PKG, \"JsonOutput.Error.ParentFolderNotExist\", parentfolder.getName() ) );\n        }\n        parentfolder.createFolder();\n        if ( log.isDebug() ) {\n          logDebug( BaseMessages.getString( PKG, \"JsonOutput.Log.ParentFolderCreated\" ) );\n        }\n      }\n    } catch ( Exception e ) {\n      throw new KettleStepException( BaseMessages.getString(\n        PKG, \"JsonOutput.Error.ErrorCreatingParentFolder\", parentfolder.getName() ) );\n    } finally {\n      if ( parentfolder != null ) {\n        try {\n          parentfolder.close();\n        } catch ( Exception ex ) { /* Ignore */\n        }\n      }\n    }\n  }\n\n  public boolean openNewFile() {\n    if ( data.writer != null ) {\n      return true;\n    }\n    boolean retval = false;\n\n    try {","sourceCodeStart":320,"sourceCodeEnd":356,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsonoutput/JsonOutput.java#L320-L356","documentation":"JsonOutput.createParentFolder attempts to create the output file's parent directory (parentfolder.createFolder()) and wraps any failure in KettleStepException with JsonOutput.Error.ErrorCreatingParentFolder. It fires when the directory cannot be created or even probed due to permissions, invalid paths, or filesystem errors.","triggerScenarios":"createParentFolder (called from openNewFile) hits an Exception while checking/creating the parent directory of the output filename — e.g. mkdir fails due to permissions, path component is a file, or invalid characters in the path.","commonSituations":"Output path's parent directory doesn't exist and the user lacks create permission; path contains illegal characters on Windows; output points inside a read-only container layer; filename variable resolves to an empty/garbage path.","solutions":["Pre-create the parent directory manually or via a job 'Create a folder' entry before the transformation runs.","Grant the process user write/create permissions on the parent directory.","Log the resolved filename to verify the path is valid; fix any environment variables that don't resolve.","Choose a different, writable output directory."],"exampleFix":"// before\n<filename>/app/read-only/out.json</filename>\n// after\n<filename>${Internal.Job.Filename.Directory}/output/out.json</filename>","handlingStrategy":"validation","validationCode":"// Job entry script before transformation\nPath parent = Paths.get(outputFile).getParent();\nif (parent != null && !Files.exists(parent)) {\n  Files.createDirectories(parent); // fails early with a clear OS error if not permitted\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-create output directories in deployment/pipeline setup.","Validate environment variables used in the filename resolve to a real path.","Run the PDI process under an account with create rights on the output tree."],"tags":["pdi","filesystem","mkdir","permissions","kettle"],"backgroundTag":"mkdir-permission-denied","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"}