If you are seeing this specifically in the interface:

Most modern MCUs cannot write directly to internal flash via a low-pin-count debugger (like SWD or JTAG) without temporary RAM code. The process looks like this:

JLinkExe -device STM32F103C8 -if SWD -speed 4000 -autoconnect 1 > unlock Kinetis # Even for STM32, this triggers a mass erase > erase > exit

To never see writing flash programmer... fail again, incorporate these three rules into your development cycle: