Reason for failed query plan executions in SQL Server
The best way I know to solve this is to set up Extended Events. Specifically you can capture the error_reported event. Use Causality Tracking along with batch/rpc starting and batch/rpc completed to capture every bit of data about what's happening with the queries. Be sure to use some good filtering because this could generate quite a lot of data.