pentaho/pentaho-kettle · error · KettleException

JobGetMailsFromPOP.Error.AttachmentFolderNotExist

Error message

JobGetMailsFromPOP.Error.AttachmentFolderNotExist

What it means

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.

Solutions

  1. Pre-create the attachments directory at the configured path.
  2. Enable the 'Create local folder' option so the entry creates missing directories automatically.
  3. Provision the directory in the deployment/CI environment (or mount the share) before kitchen runs the job.

Example fix

// before
mkdir -p skipped; entry throws
// after
<create_local_folder>Y</create_local_folder>  (or: mkdir -p /data/attachments)
Defensive patterns

Strategy: validation

Validate before calling

File att = new File(environmentSubstitute(getAttachmentFolder()));
if (!att.exists() && !att.mkdirs()) {
  throw new IllegalArgumentException("Attachments directory missing and could not be created: " + att);
}

Try / catch

try { executeJobEntry(); } catch (KettleException e) {
  if (e.getMessage().contains("AttachmentFolderNotExist")) {
    logError("Attachments directory does not exist: " + e.getMessage() + " — create it or enable 'Create local folder'");
  } else { throw e; }
}

Prevention

When it happens

Trigger: createOutputDirectory(FOLDER_ATTACHMENTS) with folder.exists() false, isCreateLocalFolder() false — the attachments directory is absent and folder auto-creation is disabled.

Common situations: 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.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/735ed87956fa7600. Report an issue: GitHub.

Appendix: source

Thrown at plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/JobEntryGetPOP.java:1616

        switch ( folderType ) {
          case JobEntryGetPOP.FOLDER_OUTPUT:
            logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.Log.OutputFolderExists", folderName ) );
            break;
          case JobEntryGetPOP.FOLDER_ATTACHMENTS:
            logDebug( BaseMessages.getString( PKG, "JobGetMailsFromPOP.Log.AttachmentFolderExists", folderName ) );
            break;
        }
      }
    } else {
      if ( isCreateLocalFolder() ) {
        folder.createFolder();
      } else {
        switch ( folderType ) {
          case JobEntryGetPOP.FOLDER_OUTPUT:
            throw new KettleException( BaseMessages.getString(
              PKG, "JobGetMailsFromPOP.Error.OutputFolderNotExist", folderName ) );
          case JobEntryGetPOP.FOLDER_ATTACHMENTS:
            throw new KettleException( BaseMessages.getString(
              PKG, "JobGetMailsFromPOP.Error.AttachmentFolderNotExist", folderName ) );
        }
      }
    }

    String returnValue = KettleVFS.getFilename( folder );
    try {
      folder.close();
    } catch ( IOException ignore ) {
      //Ignore error, as the folder was created successfully
    }
    return returnValue;
  }
}

View on GitHub (pinned to f3058517a1)