pentaho/pentaho-kettle · error · KettleException

MailConnection.Error.MovingMessages

Error message

MailConnection.Error.MovingMessages

What it means

moveMessages() wraps any Exception thrown while moving messages (appending to destination and deleting from source) in a KettleException with this message. It reports the destination folder name (mbox path or IMAP folder) plus the underlying cause.

Solutions

  1. Inspect the wrapped cause (e.getCause()) for the real failure
  2. Verify write permissions and free disk space on the destination mbox path
  3. Reconnect/reopen the IMAP folder and retry the move
  4. For IMAP, confirm the destination folder exists via folderExists()/createFolder() before moving

Example fix

// before
connection.moveMessages();
// after
try {
  connection.moveMessages();
} catch ( KettleException e ) {
  logError( "Move failed: " + e.getCause(), e ); // diagnose underlying IO/MessagingException
}
Defensive patterns

Strategy: try-catch

Validate before calling

if ( connection.getProtocol() == MailConnectionMeta.PROTOCOL_MBOX ) {
  assert new java.io.File( connection.getDestinationMboxPath() ).getParentFile().canWrite();
} else {
  assert connection.folderExists( connection.getDestinationIMAPFolder().getName() );
}

Try / catch

try {
  connection.moveMessages();
} catch ( KettleException e ) {
  Throwable cause = e.getCause();
  logError( "Move to " + dest + " failed: " + cause, e );
  // retry once after reconnecting
}

Prevention

When it happens

Trigger: Any failure inside moveMessages(): appendMessagesToMbox() or deleteMessages() throwing, e.g. IO error writing the destination mbox, or MessagingException on the IMAP folder during copy/delete.

Common situations: Destination mbox file not writable or on a full disk; IMAP connection dropped mid-move; destination IMAP folder deleted by another client; message flags cannot be set.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


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

Appendix: source

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

    try {
      if ( this.protocol == MailConnectionMeta.PROTOCOL_MBOX ) {
        if ( this.destinationMboxPath == null ) {
          throw new KettleException( BaseMessages.getString( PKG, ERROR_FOLDER_NOT_FOUND, "" ) );
        }
        appendMessagesToMbox( this.messages, this.destinationMboxPath );
        deleteMessages( false );
        setMovedMessagesCounter();
        return;
      }

      this.folder.copyMessages( this.messages, this.destinationIMAPFolder );
      deleteMessages( false );
      setMovedMessagesCounter();
    } catch ( Exception e ) {
      String errorMessage = ( this.protocol == MailConnectionMeta.PROTOCOL_MBOX )
        ? BaseMessages.getString( PKG, "MailConnection.Error.MovingMessages", this.destinationMboxPath )
        : BaseMessages.getString( PKG, "MailConnection.Error.MovingMessages", this.destinationIMAPFolder.getName() );
      throw new KettleException( errorMessage, e );
    }
  }

  /**
   * Check if a folder exists on server (only IMAP).
   *
   * @param foldername
   *          the name of the folder
   * @return true is folder exists
   */
  public boolean folderExists( String foldername ) {
    if ( this.protocol == MailConnectionMeta.PROTOCOL_MBOX ) {
      return new File( resolveMboxFolderPath( foldername ) ).exists();
    }

    boolean retval = false;
    Folder dfolder = null;
    try {

View on GitHub (pinned to f3058517a1)