pentaho/pentaho-kettle · error · KettleException
Mail.Exception.CouldnotFindContactPhoneField
Error message
Mail.Exception.CouldnotFindContactPhoneField
What it means
Thrown by cacheFieldsPosition when the contact-phone field configured in Mail meta cannot be found in the incoming row's RowMeta. Checked only when a contact-phone field is configured; indexOfValue returning -1 throws the KettleException.
Solutions
- Correct the 'Contact Phone fieldname' setting to match an existing column
- Guarantee the column upstream (default empty string if needed)
- Clear the contact-phone field setting if not used
Example fix
// before
meta.setContactPhone("phone_no");
// after
meta.setContactPhone("phone_number"); Defensive patterns
Strategy: validation
Validate before calling
// ensure the contact-phone field exists when configured
if (!isEmpty(meta.getContactPhone()) && rowMeta.indexOfValue(meta.getContactPhone()) < 0) {
logError("Contact phone field not in stream: " + meta.getContactPhone());
} Try / catch
try {
step.processRow();
} catch (KettleException e) {
if (e.getMessage().contains("CouldnotFindContactPhoneField")) {
logError("Contact phone field missing: " + e.getMessage());
}
} Prevention
- Configure contact-phone only when the column exists on all paths
- Default empty-string via Add constants for optional data
- Preview rows to confirm the field list before running
When it happens
Trigger: meta.getContactPhone() is non-empty and data.indexOfContactPhone == -1 after indexOfValue on previousRowMeta.
Common situations: Phone column renamed or dropped upstream; mis-typed field name in the Mail step; conditional upstream logic that sometimes omits the column.
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
- Mail.Exception.CouldnotFindContactPersonField
- Mail.Exception.CouldnotFindDestinationBCcField
- Mail.Exception.CouldnotFindDestinationCcField
- Mail.Exception.CouldnotFindDestinationField
- Mail.Exception.CouldnotFindReplyAddressField
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/a4ced6a7467dfad4.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java:334
if ( !Utils.isEmpty( meta.getContactPerson() ) ) {
// cache the position of the destination field
if ( data.indexOfContactPerson < 0 ) {
String realContactPerson = meta.getContactPerson();
data.indexOfContactPerson = data.previousRowMeta.indexOfValue( realContactPerson );
if ( data.indexOfContactPerson < 0 ) {
throw new KettleException( BaseMessages.getString(
PKG, "Mail.Exception.CouldnotFindContactPersonField", realContactPerson ) );
}
}
}
// Contact Phone
if ( !Utils.isEmpty( meta.getContactPhone() ) ) {
// cache the position of the destination field
if ( data.indexOfContactPhone < 0 ) {
String realContactPhone = meta.getContactPhone();
data.indexOfContactPhone = data.previousRowMeta.indexOfValue( realContactPhone );
if ( data.indexOfContactPhone < 0 ) {
throw new KettleException( BaseMessages.getString(
PKG, "Mail.Exception.CouldnotFindContactPhoneField", realContactPhone ) );
}
}
}
// cache the position of the Server field
if ( data.indexOfServer < 0 ) {
String realServer = meta.getServer();
data.indexOfServer = data.previousRowMeta.indexOfValue( realServer );
if ( data.indexOfServer < 0 ) {
throw new KettleException( BaseMessages.getString(
PKG, "Mail.Exception.CouldnotFindServerField", realServer ) );
}
}
// Port
if ( !Utils.isEmpty( meta.getPort() ) ) {
// cache the position of the port field
if ( data.indexOfPort < 0 ) {
String realPort = meta.getPort();View on GitHub (pinned to f3058517a1)