Description
Description
In order for downloader._repo_manager._repos
to be filled with information about a repo, a number of initialization steps must take place. One of these is determining the remote URL for the repo, shown below:
Red-DiscordBot/redbot/cogs/downloader/repo_manager.py
Lines 787 to 791 in 6603cd1
If this fails to happen, a warning is put in console and the folder is silently ignored:
[2025-05-27 18:19:47] [WARNING] red.downloader: A remote URL does not exist for repo ...
This can happen if the .git
folder under datapath/cogs/RepoManager/repos/.../.git
is empty or malformed.
Later, [p]repo list
pulls from downloader._repo_manager._repos
directly, so the repo fails to be listed. If a user then tries to [p]repo add
to that repo name, they are told
The repo name you provided is already in use. Please choose another name.
This is because the repo add
command logic uses a different method in clone
to determine if the repo already exists:
Red-DiscordBot/redbot/cogs/downloader/repo_manager.py
Lines 187 to 189 in 6603cd1
In this state, the user is unable to see the repo listed, is unable to use the repo to install cogs, and is unable to install the repo again to that name.
I'm not really sure what the best way to fix this problem is, but this does come up in #support with some frequency. The solution is usually to just delete the folder, but I'm not sure what effect that has on any already installed cogs.
Reproduction
Reproduction is fairly easy, but it is unclear how something similar manages to happen in the wild. My best guess is that it has to do with improperly performed backup restorations freaking out Git when the paths change.
- Add any repo with
[p]repo add
- Shut down the bot
- Navigate to
datapath/cogs/RepoManager/repos/<the repo you added>/.git
- Delete the contents of the
.git
folder - Start up the bot
a. Notice the warning in console
b. Notice[p]repo list
does not include the repo
c. Notice[p]cog install
fails for that repo
d. Notice[p]repo add
fails if attempted again