Well, I can't figure out exactly what the problem is but the reason probably is YCM is not ready while loading Nerdtree. So I add a if condition to check if YCM is ready.
function! YCMStatusLine() abort
let l:errCounts = youcompleteme#GetErrorCount()
let l:wrnCounts = youcompleteme#...
It seems to me that the issue you're having is that your plug-in manager is correctly loading the YouCompleteMe plug-in, however it's not working right after being installed by the plug-in manager because the external steps required by YouCompleteMe are not completed yet.
So I'm going to go ahead and strongly recommend you switch from Vundle to vim-plug as ...