IF sys.fn_cdc_get_min_lsn('TableName')>@LastReadLSN or
BEGIN
SET @NewStartLSN = sys.fn_cdc_get_min_lsn('TableName')
END
I was still getting the issue after implementing the same workaround. I have found that when above condition is matching, I am getting the issue. I have added a new If condition to fix the issue. Please verify.