This may be a pin conflict on a particular STM32 model/package.
If the information given by CubeMX does not make clear what's the conflict, review the pins needed by both peripherals in the given model's datasheet - perhaps print out the Alternative Functions table and use the good old pencil method.
You may need to use a model with more pins, and/or there may be no solution for the given STM32 model.