Try fastboot erase cache after install TWRP ...
Can you post your fastboot getvar all without serial & imei no. ?
Usually this error is related to partition problem .. maybe flashing the firmware, then TWRP follow by fastboot erase cache command can fix this.
I tried to install TWRP and then I did fastboot erase cache, but it doesn't work, I'm posting the fatboot getvar all, what more can I do, if I flash system in CMD it can works?
(bootloader) version: 0.5
(bootloader) version-bootloader: 3.19.0.0000
(bootloader) version-baseband: 1.29.214500021.12G
(bootloader) version-cpld: None
(bootloader) version-microp: None
(bootloader) version-main: 6.16.708.1
(bootloader) version-misc: PVT SHIP S-ON
(bootloader) meid: 00000000000000
(bootloader) product: m8_ul
(bootloader) platform: hTCBmsm8974
(bootloader) modelid: 0P6B63000
(bootloader) cidnum: HTC__622
(bootloader) battery-status: good
(bootloader) battery-voltage: 0mV
(bootloader) partition-layout: Generic
(bootloader) security: on
(bootloader) build-mode: SHIP
(bootloader) boot-mode: FASTBOOT
(bootloader) commitno-bootloader: 205bdca3
(bootloader) hbootpreupdate: 11
(bootloader) gencheckpt: 0