Zenfone 5 a501cg soft bricked - can't mount /system /cache
It appears like when you first wiped your partitions, the process was possibly interrupted and you now have corrupt partitions which are not being recognised in TWRP.


Please go to your TWRP settings and make sure that the use rm -rf instead of formatting option is not checked.
Now go Wipe → Advanced Wipe section and try wiping all those partitions again which are currently giving unable to mount errors. Then reboot into TWRP and try again.
It is recommended that you use a charger during the wipe process so that a battery failure will not interrupt the process.



  Tried flashing custom rom again but it didn't work too.


Please post the error that you get while flashing or at least a part of the error that appears, so that your problem can be understood properly.