{"record":{"id":"a125c99f6824c90e","repo":"pentaho/pentaho-kettle","slug":"jobgetmailsfrompop-error-attachmentfoldernotafolder","errorCode":null,"errorMessage":"JobGetMailsFromPOP.Error.AttachmentFolderNotAFolder","messagePattern":"JobGetMailsFromPOP\\.Error\\.AttachmentFolderNotAFolder","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":1593,"sourceCode":"        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 ) );\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 ) {","sourceCodeStart":1575,"sourceCodeEnd":1611,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/JobEntryGetPOP.java#L1575-L1611","documentation":"Same check as the output-folder variant but for FOLDER_ATTACHMENTS: if the resolved attachments folder path exists on the VFS but is not a directory (FileType != FOLDER), this KettleException is thrown with the folder name as a parameter. The entry cannot write attachments into a non-directory.","triggerScenarios":"createOutputDirectory(FOLDER_ATTACHMENTS) with folder.exists() true and folder.getType() != FileType.FOLDER — the attachments path resolves to an existing regular file.","commonSituations":"Attachments directory points at an existing file; a mis-typed path like /data/attach.tar where /data/attach was intended; variable expansion appends a filename instead of a directory name.","solutions":["Move/delete the file occupying the configured attachments path so a directory can be used there.","Correct the 'Attachments directory' field to reference a directory path.","Verify variable substitution output resolves to a directory, not a file path."],"exampleFix":"// before\nattachments dir = /data/attachments.zip (file)\n// after\nattachments dir = /data/attachments      (directory)","handlingStrategy":"validation","validationCode":"File att = new File(environmentSubstitute(getAttachmentFolder()));\nif (att.exists() && !att.isDirectory()) {\n  throw new IllegalArgumentException(\"Attachments path exists but is not a directory: \" + att);\n}","typeGuard":null,"tryCatchPattern":"try { executeJobEntry(); } catch (KettleException e) {\n  if (e.getMessage().contains(\"AttachmentFolderNotAFolder\")) {\n    logError(\"Configured attachments path is a file, not a directory: \" + e.getMessage());\n  } else { throw e; }\n}","preventionTips":["Verify the attachments path is a directory on the executing host before scheduling.","Avoid paths whose last segment could collide with generated files.","Resolve and print substituted variables during development."],"tags":["kettle","email","filesystem","path","configuration"],"backgroundTag":"path-is-not-a-directory","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"}