pentaho/pentaho-kettle · error · KettleException

Mail.Exception.CouldnotFindDestinationBCcField

Error message

Mail.Exception.CouldnotFindDestinationBCcField

What it means

Thrown by cacheFieldsPosition when the Bcc destination field configured in the Mail meta cannot be found in the incoming row's RowMeta. Checked only when a Bcc field name is configured; the lookup returns -1 so the step aborts with a KettleException before sending.

Solutions

  1. Fix the 'Destination BCc fieldname' in the Mail step to an existing column
  2. Guarantee the column upstream with Select Values / Add constants
  3. Clear the Bcc setting if hidden-copy recipients are not used

Example fix

// before
meta.setDestinationBCc("bcc");
// after
meta.setDestinationBCc("bcc_address"); // matches stream field
Defensive patterns

Strategy: validation

Validate before calling

// ensure the Bcc field exists when configured
if (!isEmpty(meta.getDestinationBCc()) && rowMeta.indexOfValue(meta.getDestinationBCc()) < 0) {
  logError("Bcc field not in stream: " + meta.getDestinationBCc());
}

Try / catch

try {
  step.processRow();
} catch (KettleException e) {
  if (e.getMessage().contains("CouldnotFindDestinationBCcField")) {
    logError("Bcc field missing: " + e.getMessage());
  }
}

Prevention

When it happens

Trigger: meta.getDestinationBCc() is non-empty and previousRowMeta.indexOfValue returns -1, leaving data.indexOfDestinationBCc == -1.

Common situations: Bcc column removed or renamed by an upstream step; wrong field typed in the Mail step dialog; running with a different input layout than when configured.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java:274

    if ( !Utils.isEmpty( meta.getDestinationCc() ) ) {
      // cache the position of the Cc field
      if ( data.indexOfDestinationCc < 0 ) {
        String realDestinationCcFieldname = meta.getDestinationCc();
        data.indexOfDestinationCc = data.previousRowMeta.indexOfValue( realDestinationCcFieldname );
        if ( data.indexOfDestinationCc < 0 ) {
          throw new KettleException( BaseMessages.getString(
            PKG, "Mail.Exception.CouldnotFindDestinationCcField", realDestinationCcFieldname ) );
        }
      }
    }
    // BCc
    if ( !Utils.isEmpty( meta.getDestinationBCc() ) ) {
      // cache the position of the BCc field
      if ( data.indexOfDestinationBCc < 0 ) {
        String realDestinationBCcFieldname = meta.getDestinationBCc();
        data.indexOfDestinationBCc = data.previousRowMeta.indexOfValue( realDestinationBCcFieldname );
        if ( data.indexOfDestinationBCc < 0 ) {
          throw new KettleException( BaseMessages.getString(
            PKG, "Mail.Exception.CouldnotFindDestinationBCcField", realDestinationBCcFieldname ) );
        }
      }
    }
    // Sender Name
    if ( !Utils.isEmpty( meta.getReplyName() ) ) {
      // cache the position of the sender field
      if ( data.indexOfSenderName < 0 ) {
        String realSenderName = meta.getReplyName();
        data.indexOfSenderName = data.previousRowMeta.indexOfValue( realSenderName );
        if ( data.indexOfSenderName < 0 ) {
          throw new KettleException( BaseMessages.getString(
            PKG, "Mail.Exception.CouldnotFindReplyNameField", realSenderName ) );
        }
      }
    }
    // Sender address
    // cache the position of the sender field

View on GitHub (pinned to f3058517a1)