pentaho/pentaho-kettle · error · KettleException

Mail.Exception.CouldnotFindReplyAddressField

Error message

Mail.Exception.CouldnotFindReplyAddressField

What it means

Thrown by cacheFieldsPosition when the sender (reply) ADDRESS field configured in Mail meta is absent from the incoming row. Unlike the other lookups this one is unconditional: the step always expects the sender-address field, so a missing column always aborts processing.

Solutions

  1. Fix the 'Sender Address fieldname' setting to an existing incoming column
  2. Add the column upstream via Add constants if the address is fixed
  3. Re-select the field in the Mail step dialog after upstream changes

Example fix

// before
meta.setReplyAddress("from_field");
// after
meta.setReplyAddress("from_address");
Defensive patterns

Strategy: validation

Validate before calling

// the sender-address lookup is unconditional: verify it always exists
if (rowMeta.indexOfValue(meta.getReplyAddress()) < 0) {
  logError("Sender address field not in stream: " + meta.getReplyAddress());
}

Try / catch

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

Prevention

When it happens

Trigger: cacheFieldsPosition runs and data.indexOfSenderAddress == -1 after indexOfValue(meta.getReplyAddress()) on previousRowMeta.

Common situations: From-address column dropped or renamed upstream; wrong field name entered in the Mail step; reusing the step metadata with a differently-shaped input stream.

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

Appendix: source

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

    // 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
    if ( data.indexOfSenderAddress < 0 ) {
      String realSenderAddress = meta.getReplyAddress();
      data.indexOfSenderAddress = data.previousRowMeta.indexOfValue( realSenderAddress );
      if ( data.indexOfSenderAddress < 0 ) {
        throw new KettleException( BaseMessages.getString(
          PKG, "Mail.Exception.CouldnotFindReplyAddressField", realSenderAddress ) );
      }
    }

    // Reply to
    if ( !Utils.isEmpty( meta.getReplyToAddresses() ) ) {
      // cache the position of the reply to field
      if ( data.indexOfReplyToAddresses < 0 ) {
        String realReplyToAddresses = meta.getReplyToAddresses();
        data.indexOfReplyToAddresses = data.previousRowMeta.indexOfValue( realReplyToAddresses );
        if ( data.indexOfReplyToAddresses < 0 ) {
          throw new KettleException( BaseMessages.getString(
            PKG, "Mail.Exception.CouldnotFindReplyToAddressesField", realReplyToAddresses ) );
        }
      }
    }

    // Contact Person

View on GitHub (pinned to f3058517a1)