{"record":{"id":"94cf222382c4806c","repo":"pentaho/pentaho-kettle","slug":"jobgetmailsfrompop-error-attachmentfolderempty","errorCode":null,"errorMessage":"JobGetMailsFromPOP.Error.AttachmentFolderEmpty","messagePattern":"JobGetMailsFromPOP\\.Error\\.AttachmentFolderEmpty","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":1582,"sourceCode":"    String folderName = \"\";\n    switch ( folderType ) {\n      case JobEntryGetPOP.FOLDER_OUTPUT:\n        folderName = getRealOutputDirectory();\n        break;\n      case JobEntryGetPOP.FOLDER_ATTACHMENTS:\n        if ( isSaveAttachment() && isDifferentFolderForAttachment() ) {\n          folderName = getRealAttachmentFolder();\n        } else {\n          folderName = getRealOutputDirectory();\n        }\n        break;\n    }\n    if ( Utils.isEmpty( folderName ) ) {\n      switch ( folderType ) {\n        case JobEntryGetPOP.FOLDER_OUTPUT:\n          throw new KettleException( BaseMessages.getString( PKG, \"JobGetMailsFromPOP.Error.OutputFolderEmpty\" ) );\n        case JobEntryGetPOP.FOLDER_ATTACHMENTS:\n          throw new KettleException( BaseMessages.getString( PKG, \"JobGetMailsFromPOP.Error.AttachmentFolderEmpty\" ) );\n      }\n    }\n    FileObject folder = KettleVFS.getInstance( parentJobMeta.getBowl() ).getFileObject( folderName, this );\n    if ( folder.exists() ) {\n      if ( folder.getType() != FileType.FOLDER ) {\n        switch ( folderType ) {\n          case JobEntryGetPOP.FOLDER_OUTPUT:\n            throw new KettleException( BaseMessages.getString(\n              PKG, \"JobGetMailsFromPOP.Error.NotAFolderNot\", folderName ) );\n          case JobEntryGetPOP.FOLDER_ATTACHMENTS:\n            throw new KettleException( BaseMessages.getString(\n              PKG, \"JobGetMailsFromPOP.Error.AttachmentFolderNotAFolder\", folderName ) );\n        }\n      }\n      if ( isDebug() ) {\n        switch ( folderType ) {\n          case JobEntryGetPOP.FOLDER_OUTPUT:\n            logDebug( BaseMessages.getString( PKG, \"JobGetMailsFromPOP.Log.OutputFolderExists\", folderName ) );","sourceCodeStart":1564,"sourceCodeEnd":1600,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/JobEntryGetPOP.java#L1564-L1600","documentation":"createOutputDirectory(FOLDER_ATTACHMENTS) throws this KettleException when the resolved attachments folder path is empty. Attachments extracted from fetched mails need a target directory; an empty one aborts the entry before any mail is processed.","triggerScenarios":"execute() -> createOutputDirectory(FOLDER_ATTACHMENTS) with Utils.isEmpty(folderName) true: the attachments directory field is blank or its variable resolves to empty string.","commonSituations":"'Attachments directory' left blank even though 'include attachments' is selected; variable ${ATTACH_DIR} undefined at runtime; entry copied from a template where the field was cleared.","solutions":["Fill in the 'Attachments directory' field with a valid absolute path.","Define any variable used for the attachments directory before the job runs.","Disable attachment saving (uncheck include attachments) if attachments are not needed, so the field is irrelevant."],"exampleFix":"// before (kjb XML)\n<attachment_folder></attachment_folder>\n// after\n<attachment_folder>/data/pentaho/mail_attachments</attachment_folder>","handlingStrategy":"validation","validationCode":"String att = environmentSubstitute(getAttachmentFolder());\nif (includeAttachments() && (att == null || att.trim().isEmpty())) {\n  throw new IllegalArgumentException(\"Attachments folder must be set when saving attachments\");\n}","typeGuard":null,"tryCatchPattern":"try { executeJobEntry(); } catch (KettleException e) {\n  if (e.getMessage().contains(\"AttachmentFolderEmpty\")) {\n    logError(\"Attachments directory is empty; set attachment_folder or disable attachment saving\");\n  } else { throw e; }\n}","preventionTips":["Fill the attachments directory whenever attachment saving is enabled.","Define attachment-folder variables in kettle.properties for all environments.","Include a validation step/job before fetching mail."],"tags":["kettle","email","configuration","filesystem","empty-field"],"backgroundTag":"empty-required-field","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"}