{"record":{"id":"14d9bca6920a60b7","repo":"pentaho/pentaho-kettle","slug":"mailconnection-error-movingmessage","errorCode":null,"errorMessage":"MailConnection.Error.MovingMessage","messagePattern":"MailConnection\\.Error\\.MovingMessage","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/MailConnection.java","lineNumber":1173,"sourceCode":"        appendMessagesToMbox( new Message[] { this.message }, this.destinationMboxPath );\n        updatedMovedMessagesCounter();\n        deleteMessage();\n        return;\n      }\n\n      // move all messages\n      this.folder.copyMessages( new Message[] { this.message }, this.destinationIMAPFolder );\n      updatedMovedMessagesCounter();\n      // Make sure to delete messages\n      deleteMessage();\n    } catch ( Exception e ) {\n      int messageNumber = getEffectiveMessageNumber( getMessage() );\n      String errorMessage = ( this.protocol == MailConnectionMeta.PROTOCOL_MBOX )\n        ? BaseMessages.getString( PKG, \"MailConnection.Error.MovingMessage\", \"\"\n          + messageNumber, this.destinationMboxPath )\n        : BaseMessages.getString( PKG, \"MailConnection.Error.MovingMessage\", \"\"\n          + messageNumber, this.destinationIMAPFolder.getName() );\n      throw new KettleException( errorMessage, e );\n    }\n  }\n\n  /**\n   * Returns the foldername.\n   *\n   * @return foldername\n   */\n  public String getFolderName() {\n    if ( this.protocol == MailConnectionMeta.PROTOCOL_MBOX ) {\n      return Const.NVL( this.mboxFolderName, \"\" );\n    }\n\n    if ( this.folder == null ) {\n      return \"\";\n    }\n    return this.folder.getName();\n  }","sourceCodeStart":1155,"sourceCodeEnd":1191,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/MailConnection.java#L1155-L1191","documentation":"MailConnection.moveMessage() wraps any exception from the actual move (append to MBOX then delete, or IMAP copy/append plus flagging) into a KettleException with key MailConnection.Error.MovingMessage, the effective message number, and the destination (MBOX path or IMAP folder name). The original cause is attached.","triggerScenarios":"Calling moveMessage() after setDestinationFolder() when appendMessagesToMbox(), deleteMessage(), or the IMAP appendMessages/copyMessages path throws — e.g. quota exceeded, destination folder closed, connection lost mid-move.","commonSituations":"IMAP server quota exceeded while appending; destination folder was closed or expunged; network drop between append and delete; MBOX file locked by another process.","solutions":["Read the wrapped cause for the exact JavaMail error (quota, connection, folder state).","Reconnect/reopen the destination folder and retry the move.","Check IMAP quota (server-side) and free space on the MBOX filesystem.","Ensure no other process holds a lock on the MBOX file."],"exampleFix":"// before\nconnection.moveMessage(); // fails silently inside loop, no diagnostics\n// after\ntry {\n  connection.moveMessage();\n} catch (KettleException e) {\n  logError(\"Move of message failed to \" + destination + \": \" + e.getMessage(), e);\n  connection.disconnect();\n  connection.connect(); // retry after reopening\n}","handlingStrategy":"try-catch","validationCode":"// verify connectivity and quota before moving\nif (!connection.isConnected()) { connection.connect(); }","typeGuard":null,"tryCatchPattern":"try { connection.moveMessage(); } catch (KettleException e) { Throwable cause = e.getCause(); logError(\"Move failed for message to \" + destination + \": \" + cause, e); }","preventionTips":["Monitor IMAP quota and MBOX disk free space","Retry with reconnect on transient network failures","Avoid concurrent writers to the same MBOX file"],"tags":["javamail","imap","mbox","message-move"],"backgroundTag":"api-error-response","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"}