The following error can have two main reasons:
Metadata request failed with status 500
There is no attachment present in the field for the specific record.
The specified record does not exist (anymore).
Please double check that the record in question does exist and has an attachment present in the field configured for this automation.