For about the 3rd time in the last 6 weeks my database has cleared and i’ve lost all data history including energy data. Found this in the log file
sqlalchemy.exc.DatabaseError: (sqlite3.DatabaseError) database disk image is malformed
[SQL: UPDATE states SET old_state_id=? WHERE states.old_state_id IN
followed by a heap of ?,s
then
[parameters: (None, 4055040, 4055041, 4055042, 4055043, 4055044, 4055045, 4055046, 4055047, 4055048, 4055049, 4055050, 4055051, 4055052, 4055053, 4055054, 4055055, 4055056, 4055057, 4055058, 4055059, 4055060, 4055061, 4055062, 4055063, 4055064, 4055065, 4055066, 4055067, 4055068, 4055069, 4055070, 4055071, 4055072, 4055073, 4055074, 4055075, 4055076, 4055077, 4055078, 4055079, 4055080, 4055081, 4055082, 4055083, 4055084, 4055085, 4055086, 4055087, 4055088 … 3901 parameters truncated … 4054990, 4054991, 4054992, 4054993, 4054994, 4054995, 4054996, 4054997, 4054998, 4054999, 4055000, 4055001, 4055002, 4055003, 4055004, 4055005, 4055006, 4055007, 4055008, 4055009, 4055010, 4055011, 4055012, 4055013, 4055014, 4055015, 4055016, 4055017, 4055018, 4055019, 4055020, 4055021, 4055022, 4055023, 4055024, 4055025, 4055026, 4055027, 4055028, 4055029, 4055030, 4055031, 4055032, 4055033, 4055034, 4055035, 4055036, 4055037, 4055038, 4055039)]
(Background on this error at: Error Messages — SQLAlchemy 2.0 Documentation)
2025-02-05 04:12:14.614 ERROR (Recorder) [homeassistant.components.recorder.util] The system will rename the corrupt database file //config/home-assistant_v2.db to //config/home-assistant_v2.db.corrupt.2025-02-04T17:12:14.614814+00:00 in order to allow startup to proceed
There doesn’t seem to be a .db.corrupt file in my config folder also
Any help on how to fix this or what is causing it is appreciated.
HA is running on VirtualBox via a Windows 11 PC. Setup as intructions show on HA site.