{"record":{"id":"bb6bbd30073c82f2","repo":"pentaho/pentaho-kettle","slug":"mail-exception-attachedcontentfieldempty","errorCode":null,"errorMessage":"Mail.Exception.AttachedContentFieldEmpty","messagePattern":"Mail\\.Exception\\.AttachedContentFieldEmpty","errorType":"validation","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java","lineNumber":413,"sourceCode":"    if ( !Utils.isEmpty( meta.getComment() ) ) {\n      // cache the position of the comment field\n      if ( data.indexOfComment < 0 ) {\n        String realComment = meta.getComment();\n        data.indexOfComment = data.previousRowMeta.indexOfValue( realComment );\n        if ( data.indexOfComment < 0 ) {\n          throw new KettleException( BaseMessages.getString(\n            PKG, \"Mail.Exception.CouldnotFindCommentField\", realComment ) );\n        }\n      }\n    }\n\n    if ( meta.isAttachContentFromField() ) {\n      // We are dealing with file content directly loaded from file\n      // and not physical file\n      String attachedContentField = meta.getAttachContentField();\n      if ( Utils.isEmpty( attachedContentField ) ) {\n        // Empty Field\n        throw new KettleException( BaseMessages.getString( PKG, \"Mail.Exception.AttachedContentFieldEmpty\" ) );\n      }\n      data.indexOfAttachedContent = data.previousRowMeta.indexOfValue( attachedContentField );\n      if ( data.indexOfAttachedContent < 0 ) {\n        throw new KettleException( BaseMessages.getString(\n          PKG, \"Mail.Exception.CouldnotFindAttachedContentField\", attachedContentField ) );\n      }\n      // Attached content filename\n      String attachedContentFileNameField = meta.getAttachContentFileNameField();\n      if ( Utils.isEmpty( attachedContentFileNameField ) ) {\n        // Empty Field\n        throw new KettleException( BaseMessages.getString(\n          PKG, \"Mail.Exception.AttachedContentFileNameFieldEmpty\" ) );\n      }\n      data.IndexOfAttachedFilename = data.previousRowMeta.indexOfValue( attachedContentFileNameField );\n      if ( data.IndexOfAttachedFilename < 0 ) {\n        throw new KettleException( BaseMessages.getString(\n          PKG, \"Mail.Exception.CouldnotFindAttachedContentFileNameField\", attachedContentFileNameField ) );\n      }","sourceCodeStart":395,"sourceCodeEnd":431,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java#L395-L431","documentation":"'Attach content from field' is enabled in the Mail step, which means email attachments come from row data rather than physical files, but the 'attached content field' setting is empty. The step refuses to continue because it cannot know which field holds the attachment content.","triggerScenarios":"meta.isAttachContentFromField() is true and Utils.isEmpty(meta.getAttachContentField()) — the 'Content field' name in the attachment section was never filled in.","commonSituations":"Enabling the 'attach content from field' checkbox but forgetting to specify which field carries the content; step migration/import losing the field setting.","solutions":["Open the Mail step, go to the attachment settings, and set the 'Content field' to the name of the field holding the attachment content.","If attachments should come from files instead, disable 'Attach content from field'.","Ensure an upstream step actually produces the content field."],"exampleFix":"// before\n// isAttachContentFromField = true, attachContentField = \"\"\n// after\n// meta.setAttachContentField(\"file_content\"); // field produced upstream","handlingStrategy":"validation","validationCode":"if (meta.isAttachContentFromField()\n    && (meta.getAttachContentField() == null || meta.getAttachContentField().isEmpty())) {\n  throw new KettleException(\"'Attach content from field' is enabled but no content field is configured\");\n}","typeGuard":null,"tryCatchPattern":"try { sendMail(); } catch (KettleException e) { if (e.getMessage().contains(\"AttachedContentFieldEmpty\")) { logError(\"Set the attached-content field name in the Mail step attachment settings\"); } throw e; }","preventionTips":["Whenever enabling 'Attach content from field', fill in both the content field and the filename field.","Validate step metadata programmatically before running unattended transformations.","Avoid hand-editing transformation XML; use the dialog so required fields stay consistent."],"tags":["kettle","pentaho","mail-step","attachments"],"backgroundTag":"empty-required-field","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"}