A fatal error occurred: Write failed, the written flash region is empty

Who can help me slove this problem
I have two boards; the other one functions perfectly and the program is intact.
I am still just a student, and I do not understand much about ESP32 development

Serial Port Output:

invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
invalid header: 0xffffffff
ets Jul 29 2019 12:21:46

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)

Error log:

PS E:\Desktop\Project-ESPNow2.2> esptool --chip esp32 --port COM8 --baud 115200 write_flash 
 --flash_mode qio --flash_freq 80m --flash_size 4MB 
 0x1000 "E:\Desktop\Project-ESPNow2.2\Project-ESPNow.ino.bootloader.bin" 
 0x8000 "E:\Desktop\Project-ESPNow2.2\Project-ESPNow.ino.partitions.bin" 
 0x10000 "E:\Desktop\Project-ESPNow2.2\Project-ESPNow.ino.bin"
Warning: Deprecated: Option '--flash_mode' is deprecated. Use '--flash-mode' instead.
Warning: Deprecated: Option '--flash_freq' is deprecated. Use '--flash-freq' instead.
Warning: Deprecated: Option '--flash_size' is deprecated. Use '--flash-size' instead.
Warning: Deprecated: Command 'write_flash' is deprecated. Use 'write-flash' instead.
esptool v5.1.0
Connected to ESP32 on COM8:
Chip type:          ESP32-D0WD-V3 (revision v3.1)
Features:           Wi-Fi, BT, Dual Core + LP Core, 240MHz, Vref calibration in eFuse, Coding Scheme None
Crystal frequency:  40MHz
MAC:                5c:01:3b:67:f0:34

Stub flasher running.

Configuring flash size...
Flash will be erased from 0x00001000 to 0x00007fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x00010000 to 0x00105fff...
Flash parameters set to 0x002f.
SHA digest in image updated.
Wrote 24976 bytes (15971 compressed) at 0x00001000 in 1.5 seconds (134.2 kbit/s).
Input MD5: 798d0027412979c8218ee34e0ef33421
Flash MD5: 39d83f05ed8985d4e99e57b67b75669a

Hard resetting via RTS pin...

A fatal error occurred: Write failed, the written flash region is empty.

............................................................................................................................

PS E:\Desktop\Project-ESPNow2.2> esptool --chip esp32 --port COM8 flash_id
Warning: Deprecated: Command 'flash_id' is deprecated. Use 'flash-id' instead.
esptool v5.1.0
Connected to ESP32 on COM8:
Chip type:          ESP32-D0WD-V3 (revision v3.1)
Features:           Wi-Fi, BT, Dual Core + LP Core, 240MHz, Vref calibration in eFuse, Coding Scheme None
Crystal frequency:  40MHz
MAC:                5c:01:3b:67:f0:34

Stub flasher running.

Flash Memory Information
................................................
Manufacturer: 85
Device: 2016
Detected flash size: 4MB
Flash voltage set by a strapping pin: 3.3V

Hard resetting via RTS pin..```

Hi @onlyforyou. I see another report of someone encountering this "Write failed, the written flash region is empty." error here:

https://esp32.com/viewtopic.php?t=46528

They reported the solution they found:

Flash voltage was wet wrong., blew the e fuses and it's now abled to be programmed.

That is quite vague, but I believe they mean they used the espefuse tool to "burn" the one-time-programmable "eFuses" on the ESP32 that control the flash voltage regulator:

That said, I'm not at all certain that the cause of your problem is the same as theirs, nor that their solution will be applicable for your problem. The reason for my doubt is that we would expect the manufacturer of the board to burn the eFuses as appropriate, so it is not expected that you would ever need to do such a thing except in the case where you made your own board from a factory fresh bare ESP32 chip (as was the case for the community member I quoted above). However, it is possible that the eFuses burning step was accidentally skipped by the manufacturer, so it is worth checking at least.

You can read the states of the eFuses on your chip using the espefuse summary command:

I think it would be worth running that command for each of your boards and then comparing the output to see if there is a difference between the working and the non-working boards.