pentaho/pentaho-kettle · error · KettleException

Mail.Exception.CouldnotFindAuthenticationPassField

Error message

Mail.Exception.CouldnotFindAuthenticationPassField

What it means

The Mail step is configured for BASIC authentication and needs to read the authentication password from an input row field, but no field with the configured (password-encrypted) name exists in the incoming row. cacheFieldsPosition throws this KettleException when indexOfValue returns -1.

Solutions

  1. Verify the 'Authentication password' setting contains a field NAME (from the input stream), not the literal password value.
  2. Preview upstream rows to confirm the password field exists and matches exactly (case-sensitive).
  3. If the password is static, store it in the Password field as a literal (not as a field reference) so no row lookup is performed.

Example fix

// before
// Authentication password field set to: mySecretPassword (not a stream field)
// after
// Add an upstream 'Get Variables' / 'User Defined Java Expression' step
// producing field "auth_password", then set the step's password field to "auth_password"
Defensive patterns

Strategy: validation

Validate before calling

// Verify the resolved password field name exists in the input stream:
String pwdField = Utils.resolvePassword(variables, meta.getAuthenticationPassword());
if (meta.isUsingAuthentication().equals(MailMeta.AUTENTICATION_BASIC)
    && rowMeta.indexOfValue(pwdField) < 0) {
  throw new KettleException("Auth password field not found: " + pwdField);
}

Try / catch

try { sendMail(); } catch (KettleException e) { if (e.getMessage().contains("CouldnotFindAuthenticationPassField")) { logError("The authentication password setting must be a field name from the input stream"); } throw e; }

Prevention

When it happens

Trigger: Authentication is set to 'Basic', meta.getAuthenticationPassword() contains an encrypted/environment-substituted field name, and data.previousRowMeta has no field matching Utils.resolvePassword(variables, ...) result.

Common situations: The password field in the step dialog was filled with an actual password instead of a field name; upstream field renamed; the encryption/environment variable substitution produces a name that no longer matches the stream.

Understand the failure class

Related errors


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

Appendix: source

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

    // Port
    if ( !Utils.isEmpty( meta.getPort() ) ) {
      // cache the position of the port field
      if ( data.indexOfPort < 0 ) {
        String realPort = meta.getPort();
        data.indexOfPort = data.previousRowMeta.indexOfValue( realPort );
        if ( data.indexOfPort < 0 ) {
          throw new KettleException( BaseMessages.getString( PKG, "Mail.Exception.CouldnotFindPortField", realPort ) );
        }
      }
    }
    // Authentication
    if ( meta.isUsingAuthentication().equals( MailMeta.AUTENTICATION_BASIC ) ) {
      // cache the position of the Authentication password field
      if ( data.indexOfAuthenticationPass < 0 ) {
        String realAuthenticationPassword = Utils.resolvePassword( variables, meta.getAuthenticationPassword() );
        data.indexOfAuthenticationPass = data.previousRowMeta.indexOfValue( realAuthenticationPassword );
        if ( data.indexOfAuthenticationPass < 0 ) {
          throw new KettleException( BaseMessages.getString(
            PKG, "Mail.Exception.CouldnotFindAuthenticationPassField", realAuthenticationPassword ) );
        }
      }
    }
    // cache the position of the Authentication user field
    if ( meta.isUsingAuthentication().equals( MailMeta.AUTENTICATION_BASIC ) || meta.isUsingAuthentication().equals( MailMeta.AUTENTICATION_OAUTH ) ) {
      if ( data.indexOfAuthenticationUser < 0 ) {
        String realAuthenticationUser = meta.getAuthenticationUser();
        data.indexOfAuthenticationUser = data.previousRowMeta.indexOfValue( realAuthenticationUser );
        if ( data.indexOfAuthenticationUser < 0 ) {
          throw new KettleException( BaseMessages.getString(
            PKG, "Mail.Exception.CouldnotFindAuthenticationUserField", realAuthenticationUser ) );
        }
      }
    }
    // Mail Subject
    if ( !Utils.isEmpty( meta.getSubject() ) ) {
      // cache the position of the subject field

View on GitHub (pinned to f3058517a1)