A "simply flash" should do the job. But backup your files - you never know.
If a dirty flash is causing trouble - a clean setup ist always your friend.
You should clean flash, Format data (not factory reset or wipe data, common mistake), and type yes, format data is found in different locations on different twrp recoveries