WARNING: This page is about a different car, the 2020 Mazda CX-30. However, it is still accessible from the selected car via links, so may be relevant.
Set the wiring harness to the position shown in the illustration so that it does not get caught between the roof panel and the headliner.