I just updated my version of STM32CubeMX to 4.20 and now when I generate a project for the STM32F401VCTX using only the RCC-> HSE (A crystal not the internal clock) it gets stuck in SystemClock_Cofig(void). I was able to find that the issue was because for some reason the new cubeMX now uses:
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
even though only the HSE clock is used. For this reason it gets stuck in the Error Handler. This problem was not there in the previous versions of cube. Please look into this and fix this issue.