Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backup can't be deleted if files on disk is deleted #5541

Open
silenceleaf opened this issue Jan 13, 2025 · 2 comments
Open

Backup can't be deleted if files on disk is deleted #5541

silenceleaf opened this issue Jan 13, 2025 · 2 comments
Labels

Comments

@silenceleaf
Copy link

Describe the issue you are experiencing

In backup feature, if the previous backup was accidentally deleted from disk. Then the backup records on UI will never be deleted. Using CLI delete backup it returns:

Unexpected server response. Status code: 404

What type of installation are you running?

Home Assistant OS

Which operating system are you running on?

Home Assistant Operating System

Steps to reproduce the issue

  1. create backup
  2. delete backup file from disk
  3. delete backup on UI using delete back button

Anything in the Supervisor logs that might be useful for us?

2025-01-12 19:13:15.038 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140422793759328] Error handling message: Unknown error (unknown_error) junyan from 192.168.200.27 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 28, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/backup/websocket.py", line 103, in handle_delete
    agent_errors = await hass.data[DATA_MANAGER].async_delete_backup(msg["backup_id"])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/backup/manager.py", line 585, in async_delete_backup
    raise result  # unexpected error
    ^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/hassio/backup.py", line 182, in async_delete_backup
    await self._client.backups.remove_backup(
    ...<4 lines>...
    )
  File "/usr/local/lib/python3.13/site-packages/aiohasupervisor/backups.py", line 90, in remove_backup
    await self._client.delete(
        f"backups/{backup}", json=options.to_dict() if options else None
    )
  File "/usr/local/lib/python3.13/site-packages/aiohasupervisor/client.py", line 219, in delete
    return await self._request(
           ^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/aiohasupervisor/client.py", line 129, in _request
    await self._raise_on_status(response)
  File "/usr/local/lib/python3.13/site-packages/aiohasupervisor/client.py", line 76, in _raise_on_status
    raise exc_type(result.message, result.job_id)
aiohasupervisor.exceptions.SupervisorBadRequestError: Unknown error, see supervisor
2025-01-12 19:13:19.677 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140422793759328] Error handling message: Unknown error (unknown_error) junyan from 192.168.200.27 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 28, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/backup/websocket.py", line 103, in handle_delete
    agent_errors = await hass.data[DATA_MANAGER].async_delete_backup(msg["backup_id"])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/backup/manager.py", line 585, in async_delete_backup
    raise result  # unexpected error
    ^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/hassio/backup.py", line 182, in async_delete_backup
    await self._client.backups.remove_backup(
    ...<4 lines>...
    )
  File "/usr/local/lib/python3.13/site-packages/aiohasupervisor/backups.py", line 90, in remove_backup
    await self._client.delete(
        f"backups/{backup}", json=options.to_dict() if options else None
    )
  File "/usr/local/lib/python3.13/site-packages/aiohasupervisor/client.py", line 219, in delete
    return await self._request(
           ^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/aiohasupervisor/client.py", line 129, in _request
    await self._raise_on_status(response)
  File "/usr/local/lib/python3.13/site-packages/aiohasupervisor/client.py", line 76, in _raise_on_status
    raise exc_type(result.message, result.job_id)
aiohasupervisor.exceptions.SupervisorBadRequestError: Unknown error, see supervisor
2025-01-12 19:19:45.083 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140422622357552] Error handling message: Unknown error (unknown_error) junyan from 192.168.200.27 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 28, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/backup/websocket.py", line 103, in handle_delete
    agent_errors = await hass.data[DATA_MANAGER].async_delete_backup(msg["backup_id"])
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/backup/manager.py", line 585, in async_delete_backup
    raise result  # unexpected error
    ^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/hassio/backup.py", line 182, in async_delete_backup
    await self._client.backups.remove_backup(
    ...<4 lines>...
    )
  File "/usr/local/lib/python3.13/site-packages/aiohasupervisor/backups.py", line 90, in remove_backup
    await self._client.delete(
        f"backups/{backup}", json=options.to_dict() if options else None
    )
  File "/usr/local/lib/python3.13/site-packages/aiohasupervisor/client.py", line 219, in delete
    return await self._request(
           ^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/aiohasupervisor/client.py", line 129, in _request
    await self._raise_on_status(response)
  File "/usr/local/lib/python3.13/site-packages/aiohasupervisor/client.py", line 76, in _raise_on_status
    raise exc_type(result.message, result.job_id)
aiohasupervisor.exceptions.SupervisorBadRequestError: Unknown error, see supervisor


### System Health information

## System Information

version | core-2025.1.2
-- | --
installation_type | Home Assistant OS
dev | false
hassio | true
docker | true
user | root
virtualenv | false
python_version | 3.13.1
os_name | Linux
os_version | 6.6.66-haos
arch | x86_64
timezone | America/New_York
config_dir | /config

<details><summary>Home Assistant Community Store</summary>

GitHub API | ok
-- | --
GitHub Content | ok
GitHub Web | ok
HACS Data | ok
GitHub API Calls Remaining | 5000
Installed Version | 2.0.2
Stage | running
Available Repositories | 1498
Downloaded Repositories | 3

</details>

<details><summary>Home Assistant Cloud</summary>

logged_in | false
-- | --
can_reach_cert_server | ok
can_reach_cloud_auth | ok
can_reach_cloud | ok

</details>

<details><summary>Home Assistant Supervisor</summary>

host_os | Home Assistant OS 14.1
-- | --
update_channel | stable
supervisor_version | supervisor-2024.12.3
agent_version | 1.6.0
docker_version | 27.2.0
disk_total | 30.8 GB
disk_used | 4.5 GB
healthy | true
supported | true
host_connectivity | true
supervisor_connectivity | true
ntp_synchronized | true
virtualization | microsoft
board | ova
supervisor_api | ok
version_api | ok
installed_addons | SQLite Web (4.3.0), Terminal & SSH (9.16.0), Mosquitto broker (6.4.1), Get HACS (1.3.1)

</details>

<details><summary>Dashboards</summary>

dashboards | 3
-- | --
resources | 0
views | 2
mode | storage

</details>

<details><summary>Recorder</summary>

oldest_recorder_run | December 10, 2024 at 2:45 PM
-- | --
current_recorder_run | January 12, 2025 at 7:12 PM
estimated_db_size | 343.58 MiB
database_engine | sqlite
database_version | 3.47.1

</details>

### Supervisor diagnostics

_No response_

### Additional information

_No response_
@alvinchen1
Copy link

Duplicate of home-assistant/core#134761

I was able to fix this by running the command

ha backup reload

which went through and purged all the orphaned front-end backups that no longer had files on disk.

@robercy
Copy link

robercy commented Jan 16, 2025

Duplicate of home-assistant/core#134761

I was able to fix this by running the command

ha backup reload

which went through and purged all the orphaned front-end backups that no longer had files on disk.

Perfect! Solved my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants