If you have checked it's not the speed sensor/magnet, then diagnostics at a dealer is almost certainly the next step. Bite the bullet!
Yeah, I've tried a new speed sensor and it hasn't helped.
My Haibike Trekking 4 Crossbar 2022 with a "Yamaha PW-TE System, 250W, 60Nm, 25km/h" motor just went into this mode recently when I was doing an off-road hill climb I'd done many times previously with zero issues.
This is the bike:
The all new Haibike Trekking 4 Electric Bike 2022 Crossbar Yamaha driven Electric hybrid trekking bike .
www.e-bikeshop.co.uk
I've seen about a dozen reports of this exact same issue on various forums. Many of them were fixed under warranty with a straight motor swap. Which suggests it's the motor that causes this particular issue. One that claimed the problem was that "the motor no longer detects the battery".
This specific issue doesn't seem like something related to the speed sensor as you don't even get a chance to have the system detect the sensor. As soon as you turn the bike on, the odometer just flashes, and the speed sits at zero.
I've seen a lot of reports of it happening when people have tried to bypass the speed restriction. It seems like it's software that kicks the bike into 'limp mode' if it detects you trying to do that, or in my case, via some kind of malfunction as I've done about 5000 miles on this Haibike and never messed with the restriction. The bike is totally vanilla.
It would seem a bit bizarre if this is an intentional disabling of the bike and there's no way to easily get it out of 'limp mode' via the control panel.
A lot of reports on this seem to have happened around the initial 300-mile mark, which means people could get the motor swapped out for one that doesn't have this issue under warranty. It seems a bit harsh to have it happen when the bike is out of warranty, so you have to cover some kind of software malfunction out of your own pocket.
I've seen no reports of anyone who's had this error having it again after the motor swap, so it seems like there possibly was a "bad batch" of Yamaha PW motors around 2002/2003.