{"record":{"id":"c8314b452f03cf8e","repo":"pentaho/pentaho-kettle","slug":"mail-exception-couldnotfinddestinationccfield","errorCode":null,"errorMessage":"Mail.Exception.CouldnotFindDestinationCcField","messagePattern":"Mail\\.Exception\\.CouldnotFindDestinationCcField","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java","lineNumber":262,"sourceCode":"  private void cacheFieldsPosition( MailMeta meta, MailData data ) throws KettleException {\n    // cache the position of the destination field\n    if ( data.indexOfDestination < 0 ) {\n      String realDestinationFieldName = meta.getDestination();\n      data.indexOfDestination = data.previousRowMeta.indexOfValue( realDestinationFieldName );\n      if ( data.indexOfDestination < 0 ) {\n        throw new KettleException( BaseMessages.getString(\n          PKG, \"Mail.Exception.CouldnotFindDestinationField\", realDestinationFieldName ) );\n      }\n    }\n\n    // Cc\n    if ( !Utils.isEmpty( meta.getDestinationCc() ) ) {\n      // cache the position of the Cc field\n      if ( data.indexOfDestinationCc < 0 ) {\n        String realDestinationCcFieldname = meta.getDestinationCc();\n        data.indexOfDestinationCc = data.previousRowMeta.indexOfValue( realDestinationCcFieldname );\n        if ( data.indexOfDestinationCc < 0 ) {\n          throw new KettleException( BaseMessages.getString(\n            PKG, \"Mail.Exception.CouldnotFindDestinationCcField\", realDestinationCcFieldname ) );\n        }\n      }\n    }\n    // BCc\n    if ( !Utils.isEmpty( meta.getDestinationBCc() ) ) {\n      // cache the position of the BCc field\n      if ( data.indexOfDestinationBCc < 0 ) {\n        String realDestinationBCcFieldname = meta.getDestinationBCc();\n        data.indexOfDestinationBCc = data.previousRowMeta.indexOfValue( realDestinationBCcFieldname );\n        if ( data.indexOfDestinationBCc < 0 ) {\n          throw new KettleException( BaseMessages.getString(\n            PKG, \"Mail.Exception.CouldnotFindDestinationBCcField\", realDestinationBCcFieldname ) );\n        }\n      }\n    }\n    // Sender Name\n    if ( !Utils.isEmpty( meta.getReplyName() ) ) {","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java#L244-L280","documentation":"Thrown by cacheFieldsPosition when the Cc destination field configured in the Mail meta is not present in the incoming row's RowMeta. It is only checked when a Cc field name is configured; indexOfValue returning -1 triggers the KettleException. Prevents sending mail with a missing Cc address source.","triggerScenarios":"meta.getDestinationCc() is non-empty and cacheFieldsPosition finds data.indexOfDestinationCc == -1 after indexOfValue on previousRowMeta.","commonSituations":"Cc field renamed upstream; copy-pasted step config pointing to a field from another transformation; optional column not generated on all input paths.","solutions":["Correct the 'Destination Cc fieldname' setting to match an existing incoming column","Ensure the upstream step always emits the Cc column (default values in Add constants)","Disable/clear the Cc field setting if Cc is not needed"],"exampleFix":"// before\nmeta.setDestinationCc(\"cc_addr\");\n// after\nmeta.setDestinationCc(\"cc_address\"); // actual field in stream","handlingStrategy":"validation","validationCode":"// ensure the Cc field exists when configured\nif (!isEmpty(meta.getDestinationCc()) && rowMeta.indexOfValue(meta.getDestinationCc()) < 0) {\n  logError(\"Cc field not in stream: \" + meta.getDestinationCc());\n}","typeGuard":null,"tryCatchPattern":"try {\n  step.processRow();\n} catch (KettleException e) {\n  if (e.getMessage().contains(\"CouldnotFindDestinationCcField\")) {\n    logError(\"Cc field missing: \" + e.getMessage());\n  }\n}","preventionTips":["Only configure Cc when the upstream stream guarantees the column","Add default-value columns with Add constants for optional paths","Validate the stream layout in a preview run before production"],"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"}