Multiple errors when writing image file with OpenOCD and Stlink v2 to NRF51822
After nrf51 mass_erase, you probably need a reset halt.

If that doesn't help:

If you have issues, add
"set WORKAREASIZE 0" before sourcing nrf51.cfg to disable it


Did you try that?  That should eliminate problems, but the flashing will be slow.  You may have better luck with a value greater than 0 but smaller than the default, like "set WORKAREASIZE 0x2000".