Restore corrupt database after nightly purge

I’ve ran the command but with no errors found:

Nevertheless it deletes history when purging. Does this mean it’s not something with my database but more with my config?

I’ve added a new device appr. 11 days ago, but the settings in the yaml is that the recorder purges after 14 days:

recorder:
  commit_interval: 15
  purge_keep_days: 14

When running a purge the database is recreated and the old is renamed to homeassistant_v2.db.corrupt[date]. What could be the case here since the .recover doesn’t show issues?

[Update] I’ve restored to a backup 12 days ago and executed the code below and now issues appear:

action: recorder.purge
data:
  repack: true
  apply_filter: false
  keep_days: 1 (tried several values)

[Update]
I’ve restored some backups and it seems to be starting at a certain date. Testing however takes some time since it seems to trigger after updating the energy dashboard / restart HA.

[Update]
I’ve restored to 2 weeks ago, just before the moment I made a change in the energy dashboard (added usage of a Remeha hybrid heating system). Looks like that caused the issue.