Error from espHome installing an esp32u

Hi,

I have some esp32u boards that flatly refuse to install in espHome. I can install everything else but this.

When I install the new module via espHome I get the following error:

INFO ESPHome 2024.10.0
INFO Reading configuration /config/esphome/bedroom-plugs.yaml…
INFO Generating C++ source…
ERROR Could not find auto generated code begin in file, either delete the main sketch file or insert the comment again.

I have tried looking for this fault everywhere but it is always because of a yaml error in the code but this is a completely vanilla install with nothing else going on.

Can anyone shed some light on this please?

Many thanks for your time.

This is the yaml it is trying to flash:

esphome:
  name: bedroom-plugs
  friendly_name: Bedroom Plugs

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "pa7B6R3XNDcl5WG4L14TJ+u6t8FDU82r3OiigJ0IPAY="

ota:
  - platform: esphome
    password: "d0d77884819681b374264204bceffce8"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Bedroom-Plugs Fallback Hotspot"
    password: "LpOi4ZYKAwcO"

captive_portal:

Try cleaning your build.