MaxVRAMs post should be the solution. Its the UI solution, the others work too, i guess.
@niraviry i had the same issue, in my case i added a weather station, default was mph for wind speed. but i changed to m/s (since, who the heck needs land or what ever miles, aside from sea and air where its nautical miles and where it really makes sense as the unit is based on the earth, metric is so much easier all around), so HA created wind_speed_2 for me with m/s as unit. Since i did not want to use the _2 on all occasions i was using wind in future, i deleted the wind_speed entity and renamed the _2 to just wind_speed. (of course i also had wind_gust and max_daily_wind_gust with the same issue)
Then the DB threw an error at me. first error was the wind_speed has mismatching units (mph vs m/s). thats easy, it was recorded as mph, then i switched, of course the values do not match, so i deleted all the old history with the solution from here you have already followed and based your question on.
later then i had an other error, the very same you had. this time for wind_speed_2. i think you see where this goes. took me a while to understand, that this was just an information that the DB was tracking a value where it did not receive any recent updates. in other words, in my case it told me, that the entity i did monitor as wind_speed_2 did not exist any more.
so you need to check, is your entity dead because the sensor does not report any more due to battery or radio issues, or did you remove or rename it, and therefore there is no input to the DB any more.
If radio or battery, fix it and the error goes away.
if removed or renamed, delete it with the tool from MaxVRAM pointed at. no sense in recording a zero with no value to you into the db.
Cheers
Manne