Just to confirm, you are correct that the frame does accept 12 x 142 hubs.
Originally Posted by https://archiv.cube.eu/en/2021/480100
Aluminium 6061 T6 Superlite, Gravel Comfort Geometry, Flat Mount Disc, Fender & Rack Option, 12x142mm, AXH
So the next thing is to measure your new hub. Obtaining a measuring caliper is the easiest way, and ones with sufficient precision for this job can be cheap. Measure the "over locknut" distance between the surfaces of the hub which will contact the inside of your frame's dropouts (as shown at https://velo-orange.com/blogs/thevel...sure-your-hubs ).
If that distance is 148, you need a different hub or maybe different (replacement) end caps, if ones for 142 OLD exist for your hub. If it is 142, something else is wrong. Maybe posting a picture of the too-short axle install might help.