{"record":{"id":"8b5154c796dcdbd8","repo":"pentaho/pentaho-kettle","slug":"mail-exception-couldnotfindserverfield","errorCode":null,"errorMessage":"Mail.Exception.CouldnotFindServerField","messagePattern":"Mail\\.Exception\\.CouldnotFindServerField","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java","lineNumber":344,"sourceCode":"    }\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 ) {\n      String realServer = meta.getServer();\n      data.indexOfServer = data.previousRowMeta.indexOfValue( realServer );\n      if ( data.indexOfServer < 0 ) {\n        throw new KettleException( BaseMessages.getString(\n          PKG, \"Mail.Exception.CouldnotFindServerField\", realServer ) );\n      }\n    }\n    // 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 ) {","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java#L326-L362","documentation":"Thrown by cacheFieldsPosition when the SMTP server field configured in Mail meta is not found in the incoming row's RowMeta. This lookup is unconditional: the step always expects the server field, so a missing column always aborts before any mail is sent.","triggerScenarios":"cacheFieldsPosition runs and data.indexOfServer == -1 after indexOfValue(meta.getServer()) on previousRowMeta.","commonSituations":"Server column dropped/renamed by an upstream step; configured a static SMTP host in the field-based setting; reusing step metadata against a differently shaped stream.","solutions":["Fix the 'SMTP Server fieldname' setting to an existing incoming column","Add the server value upstream via Add constants if it is constant","Re-select the field in the Mail step dialog after upstream layout changes"],"exampleFix":"// before\nmeta.setServer(\"smtp_host\");\n// after\nmeta.setServer(\"smtp_server\"); // actual column in stream","handlingStrategy":"validation","validationCode":"// the server lookup is unconditional: verify it always exists\nif (rowMeta.indexOfValue(meta.getServer()) < 0) {\n  logError(\"SMTP server field not in stream: \" + meta.getServer());\n}","typeGuard":null,"tryCatchPattern":"try {\n  step.processRow();\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"CouldnotFindServerField\")) {\n    logError(\"SMTP server field missing: \" + e.getMessage());\n  }\n}","preventionTips":["Always emit the SMTP-server column upstream (Add constants if the host is fixed)","Select the field from the dropdown, never free-type","Re-open and re-save the Mail step after upstream schema changes"],"tags":["kettle","mail","field-lookup","smtp","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"}