pentaho/pentaho-kettle · error · KettleException

JobGetMailsFromPOP.InvalidDefaultFolder.Label

Error message

JobGetMailsFromPOP.InvalidDefaultFolder.Label

What it means

openDefaultFolder() throws this when store.getDefaultFolder() (or getRecursiveFolder for INBOX) returns null, so there is no default folder to work with. In JavaMail a null default folder means the store exposes no root namespace for this account/protocol.

Solutions

  1. Open a specific folder instead of the default one (set 'specify folder' with INBOX).
  2. Verify the account actually has an INBOX on the server (test in a mail client).
  3. Reconnect — the store may be stale; call disconnect() then connect() again.
  4. Check IMAP namespace support of the server; some servers need a personal-namespace prefix.

Example fix

// before: default folder on server without INBOX
mailConnection.openFolder(null, true);
// after: explicit folder
mailConnection.setSpecifiedFolders(true);
mailConnection.openFolder("INBOX", false);
Defensive patterns

Strategy: validation

Validate before calling

// after connect, before opening default folder
if (mailConnection.getStore() == null || !mailConnection.getStore().isConnected()) {
  throw new KettleException("Store not connected; cannot resolve default folder");
}

Try / catch

try {
  mailConnection.openFolder(null, true);
} catch (KettleException e) {
  // fall back to explicit INBOX
  mailConnection.openFolder("INBOX", false);
}

Prevention

When it happens

Trigger: openFolder(..., defaultFolder=true) resolves this.folder == null after store.getDefaultFolder() or getRecursiveFolder(MailConnectionMeta.INBOX_FOLDER).

Common situations: Odd IMAP server namespaces, mbox store where the INBOX path doesn't resolve, connected store in a broken state after partial connect.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

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

  }

  private void openMboxFolder( String foldername, boolean defaultFolder ) {
    this.mboxFolderName = defaultFolder ? MailConnectionMeta.INBOX_FOLDER : Const.NVL( foldername, "" );
    this.folder = null;
    this.messages = null;
    this.message = null;
    this.messagenr = -1;
  }

  private void openDefaultFolder() throws KettleException, MessagingException {
    if ( protocol == MailConnectionMeta.PROTOCOL_MBOX ) {
      this.folder = this.store.getDefaultFolder();
    } else {
      this.folder = getRecursiveFolder( MailConnectionMeta.INBOX_FOLDER );
    }

    if ( this.folder == null ) {
      throw new KettleException( BaseMessages.getString( PKG, "JobGetMailsFromPOP.InvalidDefaultFolder.Label" ) );
    }

    if ( ( folder.getType() & Folder.HOLDS_MESSAGES ) == 0 ) {
      throw new KettleException( BaseMessages.getString( PKG, "MailConnection.DefaultFolderCanNotHoldMessage" ) );
    }
  }

  private void openSpecifiedFolder( String foldername ) throws KettleException, MessagingException {
    if ( this.protocol == MailConnectionMeta.PROTOCOL_IMAP
      || this.protocol == MailConnectionMeta.PROTOCOL_MBOX ) {
      this.folder = getRecursiveFolder( foldername );
    }
    if ( this.folder == null || !this.folder.exists() ) {
      throw new KettleException( BaseMessages.getString( PKG, "JobGetMailsFromPOP.InvalidFolder.Label" ) );
    }
  }

  private void openFolderWithMode() throws MessagingException {

View on GitHub (pinned to f3058517a1)