pentaho/pentaho-kettle · error · KettleException

MailValidator.Exception.CouldnotFindField

Error message

MailValidator.Exception.CouldnotFindField

What it means

MailValidator.processRow() throws this KettleException when the configured email field cannot be found in the incoming row metadata (indexOfValue returns -1). The configured field name exists as a setting but the actual stream does not contain a field with that exact name.

Solutions

  1. Verify the exact field name in the upstream step's output preview and correct the Mail Validator's email field setting.
  2. Fix case sensitivity mismatches between the configured name and the stream field.
  3. Reconnect/rebuild the hop after upstream changes so row metadata refreshes.
  4. Use a Select Values or Get fields (ctrl-space in dialog) to pick the field name rather than typing it.

Example fix

// before
meta.setEmailField( "Email_Address" ); // stream field is actually "email"
// after
meta.setEmailField( "email" );
Defensive patterns

Strategy: validation

Validate before calling

// Guard: field must exist in incoming stream metadata
int idx = previousRowMeta.indexOfValue( meta.getEmailField() );
if ( idx < 0 ) {
  throw new IllegalArgumentException(
    "Mail Validator email field '" + meta.getEmailField() + "' not found in incoming rows" );
}

Try / catch

try {
  trans.execute( null );
} catch ( KettleException e ) {
  if ( e.getMessage().contains( "CouldnotFindField" ) ) {
    logError( "Email field missing from stream; check upstream field names/case" );
  }
  throw e;
}

Prevention

When it happens

Trigger: Running the transformation when meta.getEmailField() does not match any field in the previous step's output row metadata.

Common situations: Upstream step renamed the field (e.g. 'Email' vs 'email' — matching is case-sensitive); the field-producing step was removed or reordered; a Select Values step dropped the field.

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

Appendix: source

Thrown at plugins/mail-validator/impl/src/main/java/org/pentaho/di/trans/steps/mailvalidator/MailValidator.java:101

        }

        data.msgValidMail = environmentSubstitute( meta.getEMailValideMsg() );
        data.msgNotValidMail = environmentSubstitute( meta.getEMailNotValideMsg() );
      }

      // Check is email address field is provided
      if ( Utils.isEmpty( meta.getEmailField() ) ) {
        throw new KettleException( BaseMessages.getString( PKG, "MailValidator.Error.FilenameFieldMissing" ) );
      }

      data.realResultErrorsFieldName = environmentSubstitute( meta.getErrorsField() );

      // cache the position of the field
      if ( data.indexOfeMailField < 0 ) {
        data.indexOfeMailField = data.previousRowMeta.indexOfValue( meta.getEmailField() );
        if ( data.indexOfeMailField < 0 ) {
          // The field is unreachable !
          throw new KettleException( BaseMessages.getString(
            PKG, "MailValidator.Exception.CouldnotFindField", meta.getEmailField() ) );
        }
      }

      // SMTP check?
      if ( meta.isSMTPCheck() ) {
        if ( meta.isdynamicDefaultSMTP() ) {
          if ( Utils.isEmpty( meta.getDefaultSMTP() ) ) {
            throw new KettleException( BaseMessages.getString( PKG, "MailValidator.Error.DefaultSMTPFieldMissing" ) );
          }

          if ( data.indexOfdefaultSMTPField < 0 ) {
            data.indexOfdefaultSMTPField = data.previousRowMeta.indexOfValue( meta.getDefaultSMTP() );
            if ( data.indexOfdefaultSMTPField < 0 ) {
              // The field is unreachable !
              throw new KettleException( BaseMessages.getString(
                PKG, "MailValidator.Exception.CouldnotFindField", meta.getDefaultSMTP() ) );
            }

View on GitHub (pinned to f3058517a1)