Adding exported file to email in automation causes: Object reference not set to an instance of an object

I have a scheduled automation that runs an exception report and then loops through a list of people/email addresses/departments generates ab excel file with a filtered list for that department and then send an email to department heads with that excel file as an attachment. The part where the the attachment should be added to the email triggers an "Object reference not set to an instance of an object" error.

How can I fix this?

I assume the automation script has been running in the past without errors?
Are there any additional clues in the script's log?

Given the sense of the error message, and without additional details, my first guess is that the script could not find the file to be attached to the e-mail.

Like Gary implies, can you try changing the path for the files that you link to or attach?