I've seen this behavior with a recent version of STM32CubeMX.
The issue is fixed in X-CUBE-AI 8.1 that will be out in June.
In the mean time a workaround is to remove the .mxproject file before to generate again
Regards
Daniel
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.