Ha container image python crash on upgrade that now affects older version

I attempted a container upgrade to 2025.3.1, which has gone fine before many times. I run a rootless container using podman. However now I get this odd crash:

baggypants@pod-vm:~/.local/share/containers/storage/volumes/ho-ass/_data$ cat home-assistant.log
2025-03-10 14:18:38.685 ERROR (MainThread) [root] Uncaught exception
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 227, in <module>
    sys.exit(main())
             ~~~~^^
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 213, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 154, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
    return future.result()
           ~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/runner.py", line 122, in setup_and_run_hass
    hass = await bootstrap.async_setup_hass(runtime_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/bootstrap.py", line 342, in async_setup_hass
    await async_from_config_dict(config_dict, hass) is not None
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/bootstrap.py", line 478, in async_from_config_dict
    await async_load_base_functionality(hass)
  File "/usr/src/homeassistant/homeassistant/bootstrap.py", line 447, in async_load_base_functionality
    await asyncio.gather(
    ...<13 lines>...
    )
  File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 1538, in async_load
    await async_get(hass).async_load()
  File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 1393, in async_load
    original_device_class=entity["original_device_class"],
                          ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'original_device_class'

Things I’ve tried:

  • reverting to the previous image 2025.2.0
  • attemting to run with the image version 2025.2.5
  • removing custom_components
  • removing deps
  • removing the home-assistant_v2.db* files
  • creating a new container volume and restoring from a backup
    • This was interesting as the container did start fine, but then the exact same crash message appeared partway through the restore, which tells me it’s something in my config directory causing the issue.
  • removing the contents of python_scripts

Anyone recognise the crash dump and point me to a possible culprit?

ok, it’s something in my .storage folder that is causing it to do this.

edit:
it was the file .storage/core.entity_registry I deleted it. This has (obviously) caused issues with a good number of missing entities as various devices slowly get detected.