[Moto G Q&A, Help & Troubleshooting] gbragaalves:
"Preflash validation failed" and "Permission denied" errors

EDIT: PROBLEM SOLVED! If anyone is facing the same problem, I suggest you to download the rom files again.

Hey guys, can you help me, please?

I was able to get until bootloader, but when I start the flash5.1 bat file, I get this errors:

C:\Moto G 5.1>mfastboot.exe flash partition gpt.bin
target max-sparse-size: 256MB
sending 'partition' (32 KB)...
OKAY [ 0.025s]
writing 'partition'...
(bootloader) Preflash validation failed
FAILED (remote failure)
finished. total time: 0.321s

C:\Moto G 5.1>mfastboot.exe flash motoboot motoboot.img
target max-sparse-size: 256MB
sending 'motoboot' (1953 KB)...
OKAY [ 0.090s]
writing 'motoboot'...
(bootloader) Motoboot: Unknown partition name
(bootloader) Preflash validation failed
FAILED (remote failure)
finished. total time: 0.145s

C:\Moto G 5.1>mfastboot.exe reboot-bootloader
rebooting into bootloader...
OKAY [ 0.004s]
finished. total time: 0.005s

C:\Moto G 5.1>pause
Press any key to continue. . .

C:\Moto G 5.1>mfastboot.exe flash partition gpt.bin
target max-sparse-size: 256MB
sending 'partition' (32 KB)...
OKAY [ 0.031s]
writing 'partition'...
(bootloader) Preflash validation failed
FAILED (remote failure)
finished. total time: 0.321s

C:\Moto G 5.1>mfastboot.exe flash motoboot motoboot.img
target max-sparse-size: 256MB
sending 'motoboot' (1953 KB)...
OKAY [ 0.098s]
writing 'motoboot'...
(bootloader) Motoboot: Unknown partition name
(bootloader) Preflash validation failed
FAILED (remote failure)
finished. total time: 0.125s

C:\Moto G 5.1>mfastboot.exe flash logo logo.bin
target max-sparse-size: 256MB
sending 'logo' (1060 KB)...
OKAY [ 0.065s]
writing 'logo'...
(bootloader) Permission denied
FAILED (remote failure)
finished. total time: 0.090s

C:\Moto G 5.1>mfastboot.exe flash boot boot.img
target max-sparse-size: 256MB
sending 'boot' (10240 KB)...
OKAY [ 0.368s]
writing 'boot'...
(bootloader) Permission denied
FAILED (remote failure)
finished. total time: 0.399s

C:\Moto G 5.1>mfastboot.exe flash recovery recovery.img
target max-sparse-size: 256MB
sending 'recovery' (10240 KB)...
OKAY [ 0.382s]
writing 'recovery'...
(bootloader) Permission denied
FAILED (remote failure)
finished. total time: 0.406s

C:\Moto G 5.1>mfastboot.exe flash system system.img_sparsechunk.0
target max-sparse-size: 256MB
sending 'system' (257535 KB)...
OKAY [ 8.381s]
writing 'system'...
(bootloader) Permission denied
FAILED (remote failure)
finished. total time: 8.423s

C:\Moto G 5.1>mfastboot.exe flash system system.img_sparsechunk.1
target max-sparse-size: 256MB
sending 'system' (256925 KB)...
OKAY [ 8.522s]
writing 'system'...
(bootloader) Permission denied
FAILED (remote failure)
finished. total time: 8.546s

C:\Moto G 5.1>mfastboot.exe flash system system.img_sparsechunk.2
target max-sparse-size: 256MB
sending 'system' (256980 KB)...
OKAY [ 8.223s]
writing 'system'...
(bootloader) Permission denied
FAILED (remote failure)
finished. total time: 8.260s

C:\Moto G 5.1>mfastboot.exe flash system system.img_sparsechunk.3
target max-sparse-size: 256MB
sending 'system' (175936 KB)...
OKAY [ 5.815s]
writing 'system'...
(bootloader) Permission denied
FAILED (remote failure)
finished. total time: 5.823s

C:\Moto G 5.1>mfastboot.exe flash modem NON-HLOS.bin
target max-sparse-size: 256MB
sending 'modem' (49376 KB)...
OKAY [ 1.654s]
writing 'modem'...
(bootloader) Permission denied
FAILED (remote failure)
finished. total time: 1.694s

C:\Moto G 5.1>mfastboot.exe erase modemst1
erasing 'modemst1'...
(bootloader) Invalid partition name modemst1
FAILED (remote failure)
finished. total time: 0.046s

C:\Moto G 5.1>mfastboot.exe erase modemst2
erasing 'modemst2'...
(bootloader) Invalid partition name modemst2
FAILED (remote failure)
finished. total time: 0.008s

C:\Moto G 5.1>mfastboot.exe flash fsg fsg.mbn
target max-sparse-size: 256MB
sending 'fsg' (103 KB)...
OKAY [ 0.084s]
writing 'fsg'...
(bootloader) Permission denied
FAILED (remote failure)
finished. total time: 0.126s

C:\Moto G 5.1>mfastboot.exe erase cache
erasing 'cache'...
(bootloader) Invalid partition name cache
FAILED (remote failure)
finished. total time: 0.044s

C:\Moto G 5.1>mfastboot.exe erase userdata
erasing 'userdata'...
(bootloader) Invalid partition name userdata
FAILED (remote failure)
finished. total time: 0.006s

C:\Moto G 5.1>mfastboot.exe oem fb_mode_clear
...
OKAY [ 0.002s]
finished. total time: 0.004s

C:\Moto G 5.1>mfastboot.exe reboot-bootloader
rebooting into bootloader...
OKAY [ 0.003s]
finished. total time: 0.004s

C:\Moto G 5.1>pause
Press any key to continue. . .

And the getvar result:

C:\Moto G 5.1>mfastboot getvar all
(bootloader) version: 0.5
(bootloader) version-bootloader: 411A(*)
(bootloader) product: falcon
(bootloader) secure: yes
(bootloader) hwrev: 0x83C0
(bootloader) radio: 0x5
(bootloader) emmc: 16GB Toshiba REV=06 PRV=01 TYPE=17
(bootloader) ram: 1024MB Samsung S4 SDRAM DIE=4Gb
(bootloader) cpu: MSM8226 CS
(bootloader) cid: 0xFFFF
(bootloader) channelid: 0xDEAD
(bootloader) uid: B37F22020F000000000000000000
(bootloader) unlocked: Not supported
(bootloader) iswarrantyvoid: Not supported
(bootloader) mot_sst: 8
(bootloader) max-download-size: 536870912
(bootloader) reason: Failed to initialize partition table
(bootloader) imei:
(bootloader) meid:
(bootloader) date:
(bootloader) sku:
(bootloader) iccid:
(bootloader) cust_md5:
(bootloader) max-sparse-size: 268435456
(bootloader) current-time:
(bootloader) ro.build.fingerprint:
(bootloader) ro.build.version.full:
(bootloader) ro.build.version.qcom:
(bootloader) version-baseband:
(bootloader) kernel.version:
(bootloader) sdi.git:
(bootloader) sbl1.git:
(bootloader) rpm.git:
(bootloader) tz.git:
(bootloader) aboot.git: git=MBM-NG-V41.1A-0-g80481ae
(bootloader) qe:
(bootloader) ro.carrier:
all: listed above
finished. total time: 0.083s

The battery status is ok.

I've tried to unlock the device, but I can't get the code.

Any suggestion, please?