Daily energy cost is sometimes reset

I noticed that my daily energy cost entities sometimes reset to 0 when I restart HA. These are the sensors with the _daily_cost suffix, the Energy integration automatically generates these from the usage sensors configured in the Energy dashboard. However, on the Energy dashboard, the correct daily costs are still mentioned. Is this a bug?