{"record":{"id":"3d3024f0bb58db3f","repo":"pentaho/pentaho-kettle","slug":"mail-exception-couldnotfindauthenticationpassfield","errorCode":null,"errorMessage":"Mail.Exception.CouldnotFindAuthenticationPassField","messagePattern":"Mail\\.Exception\\.CouldnotFindAuthenticationPassField","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java","lineNumber":366,"sourceCode":"    // Port\n    if ( !Utils.isEmpty( meta.getPort() ) ) {\n      // cache the position of the port field\n      if ( data.indexOfPort < 0 ) {\n        String realPort = meta.getPort();\n        data.indexOfPort = data.previousRowMeta.indexOfValue( realPort );\n        if ( data.indexOfPort < 0 ) {\n          throw new KettleException( BaseMessages.getString( PKG, \"Mail.Exception.CouldnotFindPortField\", realPort ) );\n        }\n      }\n    }\n    // Authentication\n    if ( meta.isUsingAuthentication().equals( MailMeta.AUTENTICATION_BASIC ) ) {\n      // cache the position of the Authentication password field\n      if ( data.indexOfAuthenticationPass < 0 ) {\n        String realAuthenticationPassword = Utils.resolvePassword( variables, meta.getAuthenticationPassword() );\n        data.indexOfAuthenticationPass = data.previousRowMeta.indexOfValue( realAuthenticationPassword );\n        if ( data.indexOfAuthenticationPass < 0 ) {\n          throw new KettleException( BaseMessages.getString(\n            PKG, \"Mail.Exception.CouldnotFindAuthenticationPassField\", realAuthenticationPassword ) );\n        }\n      }\n    }\n    // cache the position of the Authentication user field\n    if ( meta.isUsingAuthentication().equals( MailMeta.AUTENTICATION_BASIC ) || meta.isUsingAuthentication().equals( MailMeta.AUTENTICATION_OAUTH ) ) {\n      if ( data.indexOfAuthenticationUser < 0 ) {\n        String realAuthenticationUser = meta.getAuthenticationUser();\n        data.indexOfAuthenticationUser = data.previousRowMeta.indexOfValue( realAuthenticationUser );\n        if ( data.indexOfAuthenticationUser < 0 ) {\n          throw new KettleException( BaseMessages.getString(\n            PKG, \"Mail.Exception.CouldnotFindAuthenticationUserField\", realAuthenticationUser ) );\n        }\n      }\n    }\n    // Mail Subject\n    if ( !Utils.isEmpty( meta.getSubject() ) ) {\n      // cache the position of the subject field","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java#L348-L384","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the 'Authentication password' setting contains a field NAME (from the input stream), not the literal password value.","Preview upstream rows to confirm the password field exists and matches exactly (case-sensitive).","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."],"exampleFix":"// before\n// Authentication password field set to: mySecretPassword (not a stream field)\n// after\n// Add an upstream 'Get Variables' / 'User Defined Java Expression' step\n// producing field \"auth_password\", then set the step's password field to \"auth_password\"","handlingStrategy":"validation","validationCode":"// Verify the resolved password field name exists in the input stream:\nString pwdField = Utils.resolvePassword(variables, meta.getAuthenticationPassword());\nif (meta.isUsingAuthentication().equals(MailMeta.AUTENTICATION_BASIC)\n    && rowMeta.indexOfValue(pwdField) < 0) {\n  throw new KettleException(\"Auth password field not found: \" + pwdField);\n}","typeGuard":null,"tryCatchPattern":"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; }","preventionTips":["Never put a literal password into the password FIELD setting; fields hold names, values come from rows.","Keep encrypted passwords in variables (e.g. ${SMTP_PASS}) when a static value is needed.","Verify authentication settings whenever copying the step between transformations."],"tags":["kettle","pentaho","mail-step","authentication"],"backgroundTag":"field-not-found-in-row","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}