If you ever tried to update your phone’s ROM and got this error FAILED (remote: partition does not exist), this is the way to fix it.
There are usually two scripts used to flash the phone: one is for linux shell and the other is a Windows batch file (.bat extension).
Open up the one you’re using to flash the device with a text editor and add the line highlighted in these snippets (the one ending in # <- ADD THIS).

Tested on Xiaomi MI4 and cancro_global_images_V7.1.2.0.KXDMICK_20160125.0000.13_4.4_global.tgz
should work on more recent releases as well

fastboot $* getvar product 2>&1 | grep "^product: *MSM8974$"
if [ $? -ne 0 ] ; then echo "Missmatching image and device"; exit 1; fi
fastboot $* getvar board_version 2>&1 | grep "^board_version: *4.4"
if [ $? -eq 0 ] ; then echo "Missmatching board version"; exit 1; fi
fastboot $* getvar board_version 2>&1 | grep "^board_version: *5.[0-9]"
if [ $? -eq 0 ] ; then echo "Missmatching board version"; exit 1; fi

fastboot $* flash partition `dirname $0`/images/gpt_both0.bin # <- ADD THIS
-------------------------------------------------------------

fastboot $* flash tz `dirname $0`/images/tz.mbn
fastboot $* flash dbi `dirname $0`/images/sdi.mbn

Shell script


fastboot %* getvar product 2>&1 | findstr /r /c:"^product: *MSM8974" || echo Missmatching image and device
fastboot %* getvar product 2>&1 | findstr /r /c:"^product: *MSM8974" || exit /B 1
fastboot %* getvar board_version 2>&1 | findstr /r /c:"^board_version: *4.4" && echo Missmatching board version
fastboot %* getvar board_version 2>&1 | findstr /r /c:"^board_version: *4.4" && exit /B 1
fastboot %* getvar board_version 2>&1 | findstr /r /c:"^board_version: *5.[0-9]" && echo Missmatching board version
fastboot %* getvar board_version 2>&1 | findstr /r /c:"^board_version: *5.[0-9]" && exit /B 1

fastboot %* flash partition %~dp0images\gpt_both0.bin # <- ADD THIS
-----------------------------------------------------

fastboot %* flash tz %~dp0images\tz.mbn

Windows bat script

Now run the flash script again, everything should be fine.