Can't update on OTA for ESP01S

I have an ESP-01S board, it works fine to update if it’s plugged in using a USB programmer. But when I try to run OTA it won’t update. It just says the below:

INFO Successfully compiled program.
INFO Connecting to 10.1.2.9
INFO Uploading .esphome/build/temp/.pioenvs/temp/firmware.bin (531232 bytes)
INFO Compressed to 379130 bytes
Uploading: [= ] 2%
ERROR Error sending data: [Errno 104] Connection reset by peer

Here is my yml file:

esphome:
  name: temp
  
esp8266:
  board: esp01_1m

wifi:
  ssid: my_ssid
  password: "password"
  fast_connect: true

captive_portal:

logger:

ota:
  safe_mode: true
  reboot_timeout: 10min
  num_attempts: 5

web_server:
  port: 80

It does have 1M of memory, so I know it’s not out. And the Web portal works just fine.

Maybe wifi is weak, can you move it closer to the AP?

Can you update from the web interface?