Cleaning up MSrepl_errors, SQL Server Replication
There a stored procedure named [sp_MShistory_cleanup] called by the job [Agent history clean up: distribution].

That job should take its params from the following setting:



Check if your job is enabled and running as scheduled.

Later edit: mentioned that job because its stored procedure has this following piece of code inside:

-- Delete MSrepl_error entries
DELETE FROM MSrepl_errors 
    WHERE time &lt;= @replerr_cutoff 
    OPTION(MAXDOP 1)
SELECT @error = @@error, @num_replerror_rows = @@rowcount
IF @error &lt;&gt; 0
    GOTO FAILURE


This should handle the errors cleanup. I checked several of my instances and they all have only new errors, not old, so I suppose the job is also doing this part correctly.

Can you run the procedure manually and see if it runs correctly?