{"record":{"id":"e57dd897ba7ec834","repo":"pentaho/pentaho-kettle","slug":"mail-exception-couldnotfindcontactpersonfield","errorCode":null,"errorMessage":"Mail.Exception.CouldnotFindContactPersonField","messagePattern":"Mail\\.Exception\\.CouldnotFindContactPersonField","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java","lineNumber":322,"sourceCode":"      // cache the position of the reply to field\n      if ( data.indexOfReplyToAddresses < 0 ) {\n        String realReplyToAddresses = meta.getReplyToAddresses();\n        data.indexOfReplyToAddresses = data.previousRowMeta.indexOfValue( realReplyToAddresses );\n        if ( data.indexOfReplyToAddresses < 0 ) {\n          throw new KettleException( BaseMessages.getString(\n            PKG, \"Mail.Exception.CouldnotFindReplyToAddressesField\", realReplyToAddresses ) );\n        }\n      }\n    }\n\n    // Contact Person\n    if ( !Utils.isEmpty( meta.getContactPerson() ) ) {\n      // cache the position of the destination field\n      if ( data.indexOfContactPerson < 0 ) {\n        String realContactPerson = meta.getContactPerson();\n        data.indexOfContactPerson = data.previousRowMeta.indexOfValue( realContactPerson );\n        if ( data.indexOfContactPerson < 0 ) {\n          throw new KettleException( BaseMessages.getString(\n            PKG, \"Mail.Exception.CouldnotFindContactPersonField\", realContactPerson ) );\n        }\n      }\n    }\n    // Contact Phone\n    if ( !Utils.isEmpty( meta.getContactPhone() ) ) {\n      // cache the position of the destination field\n      if ( data.indexOfContactPhone < 0 ) {\n        String realContactPhone = meta.getContactPhone();\n        data.indexOfContactPhone = data.previousRowMeta.indexOfValue( realContactPhone );\n        if ( data.indexOfContactPhone < 0 ) {\n          throw new KettleException( BaseMessages.getString(\n            PKG, \"Mail.Exception.CouldnotFindContactPhoneField\", realContactPhone ) );\n        }\n      }\n    }\n    // cache the position of the Server field\n    if ( data.indexOfServer < 0 ) {","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java#L304-L340","documentation":"Thrown by cacheFieldsPosition when the contact-person field configured in Mail meta is not present in the incoming row. Only checked when a contact-person field is configured; the -1 lookup result aborts the step before sending.","triggerScenarios":"meta.getContactPerson() is non-empty and data.indexOfContactPerson == -1 after indexOfValue on previousRowMeta.","commonSituations":"Contact-person column removed/renamed upstream; wrong field typed in the Mail step dialog; different input source used than when the step was configured.","solutions":["Fix the 'Contact Person fieldname' setting to an existing incoming column","Add the column upstream with Select Values / Add constants","Clear the contact-person setting if unused"],"exampleFix":"// before\nmeta.setContactPerson(\"contact_nm\");\n// after\nmeta.setContactPerson(\"contact_name\");","handlingStrategy":"validation","validationCode":"// ensure the contact-person field exists when configured\nif (!isEmpty(meta.getContactPerson()) && rowMeta.indexOfValue(meta.getContactPerson()) < 0) {\n  logError(\"Contact person field not in stream: \" + meta.getContactPerson());\n}","typeGuard":null,"tryCatchPattern":"try {\n  step.processRow();\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"CouldnotFindContactPersonField\")) {\n    logError(\"Contact person field missing: \" + e.getMessage());\n  }\n}","preventionTips":["Only enable the contact-person field when the stream supplies it","Pick fields from the dropdown to avoid typos","Re-check the mapping after upstream refactors"],"tags":["kettle","mail","field-lookup","configuration"],"backgroundTag":"resource-not-found","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"}