TWRP saying no OS is installed Device information:


Motorola Moto G5 16GB (Cedric)
Stock firmware, android 7.0
Custom recovery TWRP 3.2.1-0 (previously 3.1.0-0)
Bootloader unlocked (obviously)
Rooted, Magisk v15.0


I was just going to install Xposed framework, but there normal Xposed installer didn't work. I tried to flash the file using TWRP but I got error code 1. No /system partition. When I try to flash other zip files, I get similar error messages. When I exit TWRP it warns me and say: 'No OS installed, are you sure you want to reboot?' When I reboot to the normal system partition, it just boots back into TWRP, same thing when I turn the device on. If I boot into the bootloader and start the device from there it does work and turn on. Once turned on everything works like it's supposed to, including Magisk. I can't find anything about this online, but I do know I once messed up my phone and flashed stock firmware using adb and fastboot from my computer.

Before going back to stock, I soft bricked my device by installing PixelExperience ROM twice, first in December, the 12-11-2017 version, later in January I installed the 01-21-2018 version. This one however, didn't work at first. I installed a 64 bit version of TWRP and tried again, after which it worked. After installing it, my device didn't boot. Maybe it could, but I was sceptical since it automatically booted into recovery. But after flashing the stock firmware, it still didn't boot. I figured out on accident that booting via the bootloader did work. Possibly the custom ROM did work, but just didn't boot normally, just like the stock firmware.
Link to xda thread for the ROM:
https://forum.xda-developers.com/g5/development/rom-t3710800
If you would like to look at the specific versions I installed, I still have them on my computer and will share them if asked. I completely reverted to stock and but it still wasn't fixed.

Edit:
I just saw this in TWRP, it says the system partition I've been having problems with is 17592186044369 MB, which is about 16777216 TB or 16384 PB. That's not correct of course. Can't seem to find anything about this only, though.

 

Oh and for my English, it isn't my native language and I'm only 14, so if you have trouble understanding it, please say it so I can explain it in another way.
When you just flashed the os, twrp will tell you sure you want to reboot with no os installed, even if you just installed it , i dont know why but reboot system after flashing the OS and your device should boot normally!