I am facing "TypeError: Return value of Magento\Framework\Filter\DirectiveProcessor\TemplateDirective::process() must be of the type string" error while sending sales email like (order confirmation,credit memo. shipment) etc

Here are some details

Magento/2.4 (Enterprise)

PHP 7.3.27-9+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Feb 23 2021 15:10:08) ( NTS )

Please share your thoughts on this how to fix it ?

  • any thoughts on this ?
    – devhs
    Commented May 28, 2021 at 8:26
  • any thoughts on this ?
    – devhs
    Commented May 28, 2021 at 8:50
  • were you able to figure this out? I'm having this exact issue
    – nullwriter
    Commented Mar 8, 2022 at 17:08

2 Answers 2


In my case, when I received the email I got this error message "Error filtering template: Argument 'value' must be type of string, NULL given."

Apparently this came because I had the "subject" field poorly defined in the email template.

I have updated it this way in the template and it works, in case it helps you:

<!-- This is the subject of the email -->
<!--@subject {{trans "This is your custom subject"}} @-->


  • Thanks. it works for me. Commented Feb 14 at 10:24

Check your email templates. Maybe a variable you add returns a type other than string

  • I'm having this issue, I've removed all content from email templates and just left a simple string....but this issue is still showing??
    – nullwriter
    Commented Mar 8, 2022 at 17:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.