{"record":{"id":"735ed87956fa7600","repo":"pentaho/pentaho-kettle","slug":"jobgetmailsfrompop-error-attachmentfoldernotexist","errorCode":null,"errorMessage":"JobGetMailsFromPOP.Error.AttachmentFolderNotExist","messagePattern":"JobGetMailsFromPOP\\.Error\\.AttachmentFolderNotExist","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/JobEntryGetPOP.java","lineNumber":1616,"sourceCode":"        switch ( folderType ) {\n          case JobEntryGetPOP.FOLDER_OUTPUT:\n            logDebug( BaseMessages.getString( PKG, \"JobGetMailsFromPOP.Log.OutputFolderExists\", folderName ) );\n            break;\n          case JobEntryGetPOP.FOLDER_ATTACHMENTS:\n            logDebug( BaseMessages.getString( PKG, \"JobGetMailsFromPOP.Log.AttachmentFolderExists\", folderName ) );\n            break;\n        }\n      }\n    } else {\n      if ( isCreateLocalFolder() ) {\n        folder.createFolder();\n      } else {\n        switch ( folderType ) {\n          case JobEntryGetPOP.FOLDER_OUTPUT:\n            throw new KettleException( BaseMessages.getString(\n              PKG, \"JobGetMailsFromPOP.Error.OutputFolderNotExist\", folderName ) );\n          case JobEntryGetPOP.FOLDER_ATTACHMENTS:\n            throw new KettleException( BaseMessages.getString(\n              PKG, \"JobGetMailsFromPOP.Error.AttachmentFolderNotExist\", folderName ) );\n        }\n      }\n    }\n\n    String returnValue = KettleVFS.getFilename( folder );\n    try {\n      folder.close();\n    } catch ( IOException ignore ) {\n      //Ignore error, as the folder was created successfully\n    }\n    return returnValue;\n  }\n}\n","sourceCodeStart":1598,"sourceCodeEnd":1631,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/JobEntryGetPOP.java#L1598-L1631","documentation":"Attachments-folder counterpart of the missing-directory error: when the resolved FOLDER_ATTACHMENTS path does not exist and isCreateLocalFolder() is false, createOutputDirectory() throws this KettleException naming the folder. The entry will not auto-create the directory unless the create option is enabled.","triggerScenarios":"createOutputDirectory(FOLDER_ATTACHMENTS) with folder.exists() false, isCreateLocalFolder() false — the attachments directory is absent and folder auto-creation is disabled.","commonSituations":"Fresh environment (new server/CI runner) lacking the attachments directory; unmounted share; field changed to a new path without creating it or enabling auto-create.","solutions":["Pre-create the attachments directory at the configured path.","Enable the 'Create local folder' option so the entry creates missing directories automatically.","Provision the directory in the deployment/CI environment (or mount the share) before kitchen runs the job."],"exampleFix":"// before\nmkdir -p skipped; entry throws\n// after\n<create_local_folder>Y</create_local_folder>  (or: mkdir -p /data/attachments)","handlingStrategy":"validation","validationCode":"File att = new File(environmentSubstitute(getAttachmentFolder()));\nif (!att.exists() && !att.mkdirs()) {\n  throw new IllegalArgumentException(\"Attachments directory missing and could not be created: \" + att);\n}","typeGuard":null,"tryCatchPattern":"try { executeJobEntry(); } catch (KettleException e) {\n  if (e.getMessage().contains(\"AttachmentFolderNotExist\")) {\n    logError(\"Attachments directory does not exist: \" + e.getMessage() + \" — create it or enable 'Create local folder'\");\n  } else { throw e; }\n}","preventionTips":["Pre-create the attachments directory on every host where the job runs.","Enable folder auto-creation in the job entry.","Add a filesystem precondition check at the start of the job."],"tags":["kettle","email","filesystem","directory","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"}