I have encountered this a few times when flashing various Sony devices. What worked for me was formatting - not just wiping - the data partition in TWRP before flashing the ROM. Of course this will lose all your data and user-installed apps, and it may not be possible to restore a pre-format TWRP data backup.