pentaho/pentaho-kettle · error · KettleException

Mail.Exception.CouldnotFindDestinationCcField

Error message

Mail.Exception.CouldnotFindDestinationCcField

What it means

Thrown by cacheFieldsPosition when the Cc destination field configured in the Mail meta is not present in the incoming row's RowMeta. It is only checked when a Cc field name is configured; indexOfValue returning -1 triggers the KettleException. Prevents sending mail with a missing Cc address source.

Solutions

  1. Correct the 'Destination Cc fieldname' setting to match an existing incoming column
  2. Ensure the upstream step always emits the Cc column (default values in Add constants)
  3. Disable/clear the Cc field setting if Cc is not needed

Example fix

// before
meta.setDestinationCc("cc_addr");
// after
meta.setDestinationCc("cc_address"); // actual field in stream
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

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

Prevention

When it happens

Trigger: meta.getDestinationCc() is non-empty and cacheFieldsPosition finds data.indexOfDestinationCc == -1 after indexOfValue on previousRowMeta.

Common situations: Cc field renamed upstream; copy-pasted step config pointing to a field from another transformation; optional column not generated on all input paths.

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/c8314b452f03cf8e. Report an issue: GitHub.

Appendix: source

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

  private void cacheFieldsPosition( MailMeta meta, MailData data ) throws KettleException {
    // cache the position of the destination field
    if ( data.indexOfDestination < 0 ) {
      String realDestinationFieldName = meta.getDestination();
      data.indexOfDestination = data.previousRowMeta.indexOfValue( realDestinationFieldName );
      if ( data.indexOfDestination < 0 ) {
        throw new KettleException( BaseMessages.getString(
          PKG, "Mail.Exception.CouldnotFindDestinationField", realDestinationFieldName ) );
      }
    }

    // Cc
    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() ) ) {

View on GitHub (pinned to f3058517a1)