Here is HOW I SOLVED IT:
This error happens when you before have updated from "U1" to "U2" and then you try to flash a firmware with "U1" (UX appears in the firmware "name")
So, the simple solution is to flash the stock firmware with the same "UX" that you had before your device gor bricked.
In my case, testing KingRaheel's ROMS I flashed an Indian firmware (...U2APK6...) at this moment I didn't know I ****ed up. But don't worry, I simply had updated the "U" and how I didn't know it, I tried to flash lots and lots of firmwares with "U1" without knowing what was happening. After long nights, I tried to flash my last firmware from SPAIN (PHE) with "U2" and it worked.
I hope I helped you. I used SM-J510FN (J5 2016)
If you have another device, try the same but with your current model, any questions, ask by twitter/dm
Sent from my SM-J510FN using XDA Labs