{"record":{"id":"e32b7236585350cf","repo":"pentaho/pentaho-kettle","slug":"mail-exception-attachedcontentfilenamefieldempty","errorCode":null,"errorMessage":"Mail.Exception.AttachedContentFileNameFieldEmpty","messagePattern":"Mail\\.Exception\\.AttachedContentFileNameFieldEmpty","errorType":"validation","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java","lineNumber":424,"sourceCode":"\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      }\n    } else {\n\n      // Dynamic Zipfilename\n      if ( meta.isZipFilenameDynamic() ) {\n        // cache the position of the attached source filename field\n        if ( data.indexOfDynamicZipFilename < 0 ) {\n          String realZipFilename = meta.getDynamicZipFilenameField();\n          data.indexOfDynamicZipFilename = data.previousRowMeta.indexOfValue( realZipFilename );\n          if ( data.indexOfDynamicZipFilename < 0 ) {\n            throw new KettleException( BaseMessages.getString(\n              PKG, \"Mail.Exception.CouldnotSourceAttachedZipFilenameField\", realZipFilename ) );","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/mail/impl/src/main/java/org/pentaho/di/trans/steps/mail/Mail.java#L406-L442","documentation":"'Attach content from field' is enabled and the attached-content field resolved fine, but the 'attached content filename field' setting is empty. The step requires a filename to give the in-memory attachment a name, so it throws this KettleException.","triggerScenarios":"meta.isAttachContentFromField() is true and Utils.isEmpty(meta.getAttachContentFileNameField()) — the filename field in the attachment settings was not specified.","commonSituations":"Configuring content attachment but overlooking the companion filename field; imported transformation metadata missing the filename setting.","solutions":["Set the 'Content filename field' (or equivalent attachment filename field) to a field from the input stream that holds the attachment file name.","Add an upstream step generating the filename field if it does not exist.","Disable 'Attach content from field' if you attach physical files instead."],"exampleFix":"// before\n// attachContentFileNameField = \"\"\n// after\n// meta.setAttachContentFileNameField(\"attachment_name\"); // field produced upstream","handlingStrategy":"validation","validationCode":"if (meta.isAttachContentFromField()\n    && (meta.getAttachContentFileNameField() == null || meta.getAttachContentFileNameField().isEmpty())) {\n  throw new KettleException(\"'Attach content from field' is enabled but the content filename field is empty\");\n}","typeGuard":null,"tryCatchPattern":"try { sendMail(); } catch (KettleException e) { if (e.getMessage().contains(\"AttachedContentFileNameFieldEmpty\")) { logError(\"Set the attachment content filename field in the Mail step\"); } throw e; }","preventionTips":["Always pair the content field with a filename field when attaching from row data.","Run a metadata validation pass over transformations before scheduling them.","Document that content attachments require both fields to be configured."],"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"}