[Moto G5S Plus Questions & Answers] voliveira92:
Ok, so I repaired system file, formated data, cache and system and tried to flash from TWRP and fastboot.

On TWRP I got the same ERROR 7 as always (tried Pixel Experience and Havoc OS, as well stock firmware Sanders_NPS26.1):

E1001: Failed to update system image.

Updater process ended with ERROR: 7

Tried again editing the assert line and the same ERROR 7 anyway.

And via fastboot (stock firmware) I got this and the phone went on bootloop after rebooting:

fastboot oem fb_mode_set

...

OKAY [ 0.004s]

finished. total time: 0.004s

fastboot flash partition gpt.bin

target reported max download size of 536870912 bytes

sending 'partition' (45 KB)...

OKAY [ 0.005s]

writing 'partition'...

(bootloader) Validating 'gpt.default.xml'

(bootloader) Security version downgrade

(bootloader) Image primary_gpt failed validation

(bootloader) Preflash validation failed

(bootloader) Cancelling 'gpt.default.xml'

FAILED (remote failure)

finished. total time: 0.073s

fastboot flash bootloader bootloader.img

target reported max download size of 536870912 bytes

sending 'bootloader' (5115 KB)...

OKAY [ 0.124s]

writing 'bootloader'...

(bootloader) Validating 'bootloader.default.xml'

(bootloader) Committing 'bootloader.default.xml'

(bootloader) - flashing 'emmc_appsboot.mbn' to 'aboot'

(bootloader) - flashing 'rpm.mbn' to 'rpm'

(bootloader) - flashing 'tz.mbn' to 'tz'

(bootloader) - flashing 'devcfg.mbn' to 'devcfg'

(bootloader) - flashing 'cmnlib.mbn' to 'cmnlib'

(bootloader) - flashing 'cmnlib64.mbn' to 'cmnlib64'

(bootloader) - flashing 'keymaster.mbn' to 'keymaster'

(bootloader) - flashing 'prov.mbn' to 'prov'

(bootloader) - flashing 'sbl1.mbn' to 'sbl1'

OKAY [ 0.704s]

finished. total time: 0.828s

fastboot flash logo logo.bin

target reported max download size of 536870912 bytes

sending 'logo' (2192 KB)...

OKAY [ 0.054s]

writing 'logo'...

OKAY [ 0.109s]

finished. total time: 0.163s

fastboot flash boot boot.img

target reported max download size of 536870912 bytes

sending 'boot' (16384 KB)...

OKAY [ 0.397s]

writing 'boot'...

(bootloader) Image signed with key bad key

OKAY [ 0.419s]

finished. total time: 0.816s

fastboot flash recovery recovery.img

target reported max download size of 536870912 bytes

sending 'recovery' (20580 KB)...

OKAY [ 0.496s]

writing 'recovery'...

(bootloader) Image signed with key bad key

OKAY [ 0.511s]

finished. total time: 1.007s

fastboot flash dsp adspso.bin

target reported max download size of 536870912 bytes

sending 'dsp' (16384 KB)...

OKAY [ 0.385s]

writing 'dsp'...

OKAY [ 0.286s]

finished. total time: 0.670s

fastboot flash oem oem.img

target reported max download size of 536870912 bytes

sending 'oem' (327830 KB)...

OKAY [ 7.627s]

writing 'oem'...

(bootloader) Preflash validation failed

FAILED (remote failure)

finished. total time: 7.669s

fastboot flash system system.img_sparsechunk.0

target reported max download size of 536870912 bytes

sending 'system' (524260 KB)...

OKAY [ 12.189s]

writing 'system'...

(bootloader) Preflash validation failed

FAILED (remote failure)

finished. total time: 12.260s

fastboot flash system system.img_sparsechunk.1

target reported max download size of 536870912 bytes

sending 'system' (522314 KB)...

OKAY [ 12.161s]

writing 'system'...

OKAY [ 6.230s]

finished. total time: 18.391s

fastboot flash system system.img_sparsechunk.2

target reported max download size of 536870912 bytes

sending 'system' (522269 KB)...

OKAY [ 12.161s]

writing 'system'...

OKAY [ 7.196s]

finished. total time: 19.356s

fastboot flash system system.img_sparsechunk.3

target reported max download size of 536870912 bytes

sending 'system' (524204 KB)...

OKAY [ 12.207s]

writing 'system'...

OKAY [ 6.143s]

finished. total time: 18.349s

fastboot flash system system.img_sparsechunk.4

target reported max download size of 536870912 bytes

sending 'system' (524139 KB)...

OKAY [ 12.211s]

writing 'system'...

OKAY [ 6.929s]

finished. total time: 19.141s

fastboot flash system system.img_sparsechunk.5

target reported max download size of 536870912 bytes

sending 'system' (435100 KB)...

OKAY [ 10.111s]

writing 'system'...

(bootloader) Invalid sparse image data

(bootloader) Failed to flash sparse image

FAILED (remote failure)

finished. total time: 12.502s

fastboot flash modem NON-HLOS.bin

target reported max download size of 536870912 bytes

sending 'modem' (75360 KB)...

OKAY [ 1.758s]

writing 'modem'...

OKAY [ 1.088s]

finished. total time: 2.846s

fastboot flash fsg fsg.mbn

target reported max download size of 536870912 bytes

sending 'fsg' (2452 KB)...

OKAY [ 0.059s]

writing 'fsg'...

OKAY [ 0.118s]

finished. total time: 0.178s

fastboot erase cache

erasing 'cache'...

OKAY [ 0.018s]

finished. total time: 0.018s

fastboot erase userdata

erasing 'userdata'...

OKAY [ 0.334s]

finished. total time: 0.334s

fastboot erase customize

erasing 'customize'...

(bootloader) Permission denied

FAILED (remote failure)

finished. total time: 0.003s

fastboot erase clogo

erasing 'clogo'...

(bootloader) Permission denied

FAILED (remote failure)

finished. total time: 0.003s

fastboot oem fb_mode_clear

...

OKAY [ 0.118s]

finished. total time: 0.118s

fastboot flash logo logo.bin

target reported max download size of 536870912 bytes

sending 'logo' (2192 KB)...

OKAY [ 0.054s]

writing 'logo'...

OKAY [ 0.131s]

finished. total time: 0.185s

I have the option of switching the system file to another format on TWRP (EXT2, EXT3, EXT4, FAT, exFAT, F2Fs), could any of those help?