Repository: home-assistant/supervisor

Issue:
Missing addons in the store for the default addons repository.  Installed addons report being removed from repository
### Describe the issue you are experiencing

Essentially, addons are missing from the default store and the installed addons report that they have been removed from the repository.

See attached images.  This happened post restore.  There was also an extended internet outage. I had some serious issue and had to restore my last full backup and most recent partial as well.  Everything is working now.  All devices and addons including Zwave JS UI are up and running.  But I have these six messages.  All for items from the official store.

I have done a full system reboot, twice.

I don't know what to do. If you look at the screenshot they are indeed gone from the store.  Any idea what's going on.  Thank you.

Logs attached

![Image](https://github.com/user-attachments/assets/794a0aca-4f4c-4cad-b352-53c393d9e2f3)
![Image](https://github.com/user-attachments/assets/6a065869-da81-4bf8-8da6-9a237bec3939)
![Image](https://github.com/user-attachments/assets/aa7d2ea9-33fe-45c8-bae4-0fe74967d676)
![Image](https://github.com/user-attachments/assets/1e371219-28e6-4044-a4df-671c57cacec3)
![Image](https://github.com/user-attachments/assets/487b2e0f-dc43-4077-8c32-14743335b7e9)
![Image](https://github.com/user-attachments/assets/b78044cf-2828-4d0f-a82c-672faf4398b6)

[supervisor_2025-02-28T20-51-12.509Z.log](https://github.com/user-attachments/files/19033041/supervisor_2025-02-28T20-51-12.509Z.log)

So I got sort of smart and found out how to delete stores on the cli thinking I could delete it and re-add it.  Also how to find the slug for the url to the store but when I tried it 
```
[core-ssh config]$ ha store ha store delete a0d7b954
Error: Can't remove built-in repositories!
```
This is odd 
```
[core-ssh ~]$ [core-ssh ~]$ ha supervisor options -r https://github.com/hassio-addons/repository
Error: Can't remove 'https://github.com/sharptools-io/hass-addons.git'. It's used by installed add-ons
```
 
Strange how it mentions sharptools even though I specified the default repository
I uninstalled sharptools since I wasn't using it and deleted it's repository.  Here is what it says when I run the command now: 
```
[core-ssh ~]$ ha supervisor options -r https://github.com/hassio-addons/repository
Error: Can't remove 'https://github.com/sabeechen/hassio-google-drive-backup'. It's used by installed add-ons
```

### 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

I am not sure how it happened so I can't tell you how to reproduce.

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

```txt
Logs are attached above
```

### System Health information

![Image](https://github.com/user-attachments/assets/34360db5-6f6b-4a2a-b873-96684be2120f)

### Supervisor diagnostics

I don't have an Integrations menu in Settings.

### Additional information

_No response_


Discussion:
Some more logs if needed.

[home-assistant.log](https://github.com/user-attachments/files/19033903/home-assistant.log)

[home-assistant.1.log](https://github.com/user-attachments/files/19033957/home-assistant.1.log)

This is interesting in the supervisor logs.  I'm pretty sure that's the slug for the default addons store - a0d7b954
```
2025-02-28 20:34:45.948 INFO (MainThread) [supervisor.resolution.evaluate] Starting system evaluation with state running
2025-02-28 20:34:46.074 INFO (MainThread) [supervisor.resolution.evaluate] System evaluation complete
2025-02-28 20:34:46.074 INFO (MainThread) [supervisor.resolution.fixup] Starting system autofix at state running
2025-02-28 20:34:46.074 INFO (MainThread) [supervisor.resolution.fixups.store_execute_reset] Reset corrupt Store: a0d7b954
2025-02-28 20:34:46.076 INFO (MainThread) [supervisor.store.git] Loading add-on /data/addons/git/a0d7b954 repository
2025-02-28 20:34:46.077 ERROR (MainThread) [supervisor.store.git] Can't load /data/addons/git/a0d7b954
```
Meanwhile, inside the supervisor's container...
```
/data/addons/git # cd cebe7a76/
/data/addons/git/cebe7a76 # ls
CONTRIBUTING.md             LOCAL_AUTH.md               donate-crypto.md            heroku.yml                  pytest.ini
LICENSE                     README.md                   hassio-google-drive-backup  images                      repository.json
/data/addons/git/cebe7a76 # cd ../a0d7b954/
/data/addons/git/a0d7b954 # ls
/data/addons/git/a0d7b954 #

```

Well that can't be good....
OMG I fixed it!  Leaving this open so someone sees it and asks the question "how did this happen?"

```
/data/addons/git/a0d7b954 # cd ..
/data/addons/git # git clone https://github.com/hassio-addons/repository a0d7b954/
Cloning into 'a0d7b954'...
remote: Enumerating objects: 21346, done.
remote: Counting objects: 100% (5228/5228), done.
remote: Compressing objects: 100% (370/370), done.
remote: Total 21346 (delta 4946), reused 4888 (delta 4856), pack-reused 16118 (from 4)
Receiving objects: 100% (21346/21346), 7.16 MiB | 20.59 MiB/s, done.
Resolving deltas: 100% (13893/13893), done.
/data/addons/git # cd a0d7b954/
/data/addons/git/a0d7b954 # ls
LICENSE.md         appdaemon          chrony             glances            lidarr             netlify.toml       phpmyadmin         repository.json    spotify            tautulli           uptime-kuma        zwave-js-ui
README.md          bazarr             emqx               grafana            log-viewer         nginxproxymanager  plex               requirements.txt   sqlite-web         thelounge          vscode
adguard            bitwarden          example            grocy              mkdocs.yml         node-red           prowlarr           runtime.txt        ssh                tor                whisparr
aircast            bookstack          foldingathome      influxdb           motioneye          nut                radarr             sabnzbd            tailscale          traccar            wireguard
airsonos           build-site.sh      ftp                jupyterlab         mqtt-io            overseerr          readarr            sonarr             tasmoadmin         unifi              zerotier
/data/addons/git/a0d7b954 #
```

I then bounced the supervisor and everything corrected!

![Image](https://github.com/user-attachments/assets/5cdc6383-658e-4637-967d-e446dab4e51b)

They're all back now.  I even have an update for zwave js ui available.
All the errors disappeared

Making a FULL backup JIC.

Thanks anyway.  I hope this all helps someone in the future.
Holupaminute  we got some errors in the supervisors log I don't like:

[supervisor_2025-03-01T04-02-31.258Z.log](https://github.com/user-attachments/files/19036755/supervisor_2025-03-01T04-02-31.258Z.log)

I fixed the appdaemon error already using this thread here - [https://community.home-assistant.io/t/appdaemon-wont-start-complains-about-secrets-yaml/641197/4](https://community.home-assistant.io/t/appdaemon-wont-start-complains-about-secrets-yaml/641197/4) so you can ignore that.  Not sure why I had to make that edit twice already but...I would still appreciate some eyes on the log.  Thanks!
the same woke up this morning and found this notification. whats happening? 
This seems what I've observed a couple of days ago, see #5668.

What I realized there is that a simple restart of Supervisor should get the stores again. Try `ha supervisor restart`.

What is a bit unclear to me why that suddenly shows up. Code around add-on store handling (which uses git repositories under the hood) didn't really change 🤔 
@TorvaldUtne can you share the health information from your system? That includes crucial data to better understand the state your system is in. The health information is not a screenshot. From the bug report form:

> System Health information can be found in the top right menu in [Settings -> System -> Repairs](https://my.home-assistant.io/redirect/repairs/). Click the copy button at the bottom of the pop-up and paste it here.

So simply copy that information and paste it in a new comment here.


Also, the Supervisor diagnostics are are under Settings > Devices & services. I'll fix the report form.
I have the same Problem. Here my health information

## System Information

version | core-2025.2.5
-- | --
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.62-haos-raspi
arch | aarch64
timezone | Europe/Berlin
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 | 4998
Installed Version | 2.0.5
Stage | running
Available Repositories | 1561
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.2
-- | --
update_channel | stable
supervisor_version | supervisor-2025.02.4
agent_version | 1.6.0
docker_version | 27.2.0
disk_total | 233.8 GB
disk_used | 11.7 GB
healthy | true
supported | true
host_connectivity | true
supervisor_connectivity | true
ntp_synchronized | true
virtualization | 
board | rpi5-64
supervisor_api | ok
version_api | ok
installed_addons | WireGuard (0.11.0), Grafana (10.4.2), AdGuard Home (5.2.5), Zigbee2MQTT (2.1.1-1)

</details>

<details><summary>Dashboards</summary>

dashboards | 3
-- | --
resources | 1
views | 3
mode | storage

</details>

<details><summary>Network Configuration</summary>

adapters | lo (disabled), end0 (enabled, default, auto), hassio (disabled), docker0 (disabled), veth0b34a18 (disabled), vethbeaa490 (disabled), veth9bcfc2c (disabled), vethb042167 (disabled), veth4eff7d5 (disabled), vethb7765a0 (disabled), vethc8017ea (disabled)
-- | --
ipv4_addresses | lo (127.0.0.1/8), end0 (192.168.172.179/24), hassio (172.30.32.1/23), docker0 (172.30.232.1/23), veth0b34a18 (), vethbeaa490 (), veth9bcfc2c (), vethb042167 (), veth4eff7d5 (), vethb7765a0 (), vethc8017ea ()
ipv6_addresses | lo (::1/128), end0 (fd85:29e2:f868:5b4e:a889:885:6844:4fca/64, fe80::2b35:a1c:2bb7:d9be/64), hassio (fe80::42:6ff:fe75:e53a/64), docker0 (fe80::42:e3ff:fe22:9bc7/64), veth0b34a18 (fe80::f42a:71ff:fe36:fbeb/64), vethbeaa490 (fe80::5485:f5ff:fe97:b024/64), veth9bcfc2c (fe80::a85b:f9ff:fe25:2be0/64), vethb042167 (fe80::649e:bcff:feb3:5da/64), veth4eff7d5 (fe80::34be:3dff:fe2f:5f9/64), vethb7765a0 (fe80::f001:66ff:fee6:e18/64), vethc8017ea (fe80::882c:fcff:fe85:db9a/64)
announce_addresses | 192.168.172.179, fd85:29e2:f868:5b4e:a889:885:6844:4fca, fe80::2b35:a1c:2bb7:d9be

</details>

<details><summary>Recorder</summary>

oldest_recorder_run | 17. Dezember 2024 um 21:17
-- | --
current_recorder_run | 1. März 2025 um 12:23
estimated_db_size | 28.90 MiB
database_engine | sqlite
database_version | 3.47.1

</details>
@Niro1965 thanks for sharing. Do you happen to have the Supervisor log from the time when the add-on store first disappeared? That is the latest version of Supervisor. Does a system reboot of the whole system bring back the add-ons for you?
Just to chime in since I can't find another issue related to this - I seem to run into the same or a similar error, tried to install mosquitto and nothing worked, so my store seems borked too :(

A reboot changed nothing, supervisor error below, which seems the 'deleted directory' problem I read about somewhere else. Sorry, I'm quite the beginner at this point :/ Can't pin down when it started, normally HA should always have internet access, but our router acted up last week, so probably then if having no internet connectivity is the culprit.

First: ERROR (MainThread) [supervisor.store.git] Can't load /data/addons/core
Further down: WARNING (MainThread) [supervisor.store.git] No valid repository for https://github.com/home-assistant/addons
Same issue for me with Matter server add on and Terminal & SSH addon

There was no change after a restart.
This message is now in red in the log.

2025-03-01 13:23:19.061 ERROR (MainThread) [supervisor.store.git] Can't load /data/addons/core

I can't tell you the exact time from yesterday.
Here is my guess.

[supervisor_2025-03-01T13-02-19.088Z.log](https://github.com/user-attachments/files/19039010/supervisor_2025-03-01T13-02-19.088Z.log)
> OMG I fixed it! Leaving this open so someone sees it and asks the question "how did this happen?"
> 
> ```
> /data/addons/git/a0d7b954 # cd ..
> /data/addons/git # git clone https://github.com/hassio-addons/repository a0d7b954/
> Cloning into 'a0d7b954'...
> ```

Are the addons back for you as `core` addons or as `Local add-ons`? For me cloning the repo into `/data/git/somehash` just adds them as local addons and I need to manually update the git repository as well as reinstall all my missing addons.

Did you clone the repo inside the supervisor container or on the HA host? Maybe this is the difference for me. When I clone it to `/data/addons/git/somehash` it looks like it ends up in `/data/addons/local/git/dea8df9/` in the supervisor container.

I am actually not missing the [Home Assistant Community Add-ons](https://github.com/hassio-addons/repository) repository but the [Home Assistant Add-ons: The official repository](https://github.com/home-assistant/addons). Strange to see the same issue with different repositories.

Best regards,
Florian.


---

Update: I was missing the [Home Assistant Add-ons: The official repository](https://github.com/home-assistant/addons) and _not_ the [Home Assistant Community Add-ons](https://github.com/hassio-addons/repository) but the same approach worked for me.

I execed into the suportvisor container

```
docker exec -it hassio_supervisor bash
```

and my `/data/addons/core` directory was empty. 

```
ls -la /data/addons/core
```

I moved it e.g. to

```
mv  /data/addons/core /data/addons/core.$(date +%F)
``` 

just to be sure and cloned the core repository again:

```
git clone https://github.com/home-assistant/addons /data/addons/core
```

Now my _Core Addons_ (official ones) are back correctly (maybe needs a refresh on the addons store page). Let's see if this lasts.

Another way to fix this is to remove the root directory (e.g. `rmdir /data/addons/core`) and restart Supervisor.
This is not fixed for me. The addons folder is under the /root folder for me and was empty. I cloned the core folder into that location but this made no difference, even after a restart. 
 The error I get is:

**Failed setup, will retry: Failed to get the Matter Server add-on info: Addon core_matter_server does not exist in the store**

Restoring a backup made no difference.

I can see the Matter addon in the Addons section of the HA GUI and start the WebUI without any problems. log files do not show any issues:

2025-03-01 16:56:10.182 (MainThread) INFO [matter_server.server.server] Matter Server successfully initialized.
2025-03-01 16:56:10.906 (MainThread) INFO [matter_server.server.device_controller.mdns] <Node:1> Discovered on mDNS
2025-03-01 16:56:10.907 (MainThread) INFO [matter_server.server.device_controller] <Node:1> Setting-up node...
2025-03-01 16:56:10.910 (MainThread) INFO [matter_server.server.device_controller.mdns] <Node:2> Discovered on mDNS
2025-03-01 16:56:10.912 (MainThread) INFO [matter_server.server.device_controller] <Node:2> Setting-up node...


These solutions haven't worked for me. I cloned the core repo into /addons/core and /data/addons/core but it still isn't recognized after a reboot. 

In the Supervisor logs, it looks like Supervisor doesn't have internet access, which seems ridiculous, really. Home assistant certainly has internet access and I am accessing it over the internet and it is working with devices that only work over the internet (boo for no local control on certain devices). 



Patch:
diff --git a/supervisor/store/git.py b/supervisor/store/git.py
index 1cf3b05517b..f0bb3a7b085 100644
--- a/supervisor/store/git.py
+++ b/supervisor/store/git.py
@@ -49,7 +49,7 @@ def branch(self) -> str:
 
     async def load(self) -> None:
         """Init Git add-on repository."""
-        if not self.path.is_dir():
+        if not (self.path / ".git").is_dir():
             await self.clone()
             return
 


Test patch:
diff --git a/tests/store/test_repository_git.py b/tests/store/test_repository_git.py
index 09c7c185092..3bb44423273 100644
--- a/tests/store/test_repository_git.py
+++ b/tests/store/test_repository_git.py
@@ -67,17 +67,30 @@ async def test_git_clone_error(
 
 async def test_git_load(coresys: CoreSys, tmp_path: Path):
     """Test git load."""
-    repo = GitRepo(coresys, tmp_path, REPO_URL)
+    repo_dir = tmp_path / "repo"
+    repo = GitRepo(coresys, repo_dir, REPO_URL)
+    repo.clone = AsyncMock()
 
-    with (
-        patch("pathlib.Path.is_dir", return_value=True),
-        patch.object(
-            GitRepo, "sys_run_in_executor", new_callable=AsyncMock
-        ) as run_in_executor,
-    ):
-        await repo.load()
+    # Test with non-existing git repo root directory
+    await repo.load()
+    assert repo.clone.call_count == 1
+
+    repo.clone.reset_mock()
 
-        assert run_in_executor.call_count == 2
+    # Test with existing git repo root directory, but empty
+    repo_dir.mkdir()
+    await repo.load()
+    assert repo.clone.call_count == 1
+
+    repo.clone.reset_mock()
+
+    # Pretend we have a repo
+    (repo_dir / ".git").mkdir()
+
+    with patch("git.Repo") as mock_repo:
+        await repo.load()
+        assert repo.clone.call_count == 0
+        assert mock_repo.call_count == 1
 
 
 @pytest.mark.parametrize(
@@ -87,21 +100,22 @@ async def test_git_load(coresys: CoreSys, tmp_path: Path):
         NoSuchPathError(),
         GitCommandError("init"),
         UnicodeDecodeError("decode", b"", 0, 0, ""),
-        [AsyncMock(), GitCommandError("fsck")],
+        GitCommandError("fsck"),
     ],
 )
 async def test_git_load_error(coresys: CoreSys, tmp_path: Path, git_errors: Exception):
     """Test git load error."""
+    coresys.hardware.disk.get_disk_free_space = lambda x: 5000
     repo = GitRepo(coresys, tmp_path, REPO_URL)
 
+    # Pretend we have a repo
+    (tmp_path / ".git").mkdir()
+
     with (
-        patch("pathlib.Path.is_dir", return_value=True),
-        patch.object(
-            GitRepo, "sys_run_in_executor", new_callable=AsyncMock
-        ) as run_in_executor,
+        patch("git.Repo") as mock_repo,
         pytest.raises(StoreGitError),
     ):
-        run_in_executor.side_effect = git_errors
+        mock_repo.side_effect = git_errors
         await repo.load()
 
     assert len(coresys.resolution.suggestions) == 0