Downloader gets stuck if .git exists but is invalid #6580
Labels
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Mrcoolgamer11/Red-DiscordBot#6580
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
In order for
downloader._repo_manager._reposto 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:github.com/Cog-Creators/Red-DiscordBot@6603cd1a86/redbot/cogs/downloader/repo_manager.py (L787-L791)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
.gitfolder underdatapath/cogs/RepoManager/repos/.../.gitis empty or malformed.Later,
[p]repo listpulls fromdownloader._repo_manager._reposdirectly, so the repo fails to be listed. If a user then tries to[p]repo addto that repo name, they are toldThe repo name you provided is already in use. Please choose another name.This is because the
repo addcommand logic uses a different method incloneto determine if the repo already exists:github.com/Cog-Creators/Red-DiscordBot@6603cd1a86/redbot/cogs/downloader/repo_manager.py (L187-L189)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.
[p]repo adddatapath/cogs/RepoManager/repos/<the repo you added>/.git.gitfoldera. Notice the warning in console
b. Notice
[p]repo listdoes not include the repoc. Notice
[p]cog installfails for that repod. Notice
[p]repo addfails if attempted againI'm thinking about how to handle this issue and have a few ideas.
One approach is to attempt re-cloning the repository:
.gitdirectory is malformed but the.git/configfile still exists, the remote URL can be extracted and used to re-clone the repository.If none of these options help, then throw an error and delete the directory, so the user can
repo addagain.Hello! I’m currently working on a school project focused on contributing to open source. I was wondering if I could take on this issue. Thank you!
You may, but this issue hasn't had a specific solution defined yet so it may not be the best one to take. You may want to join our discord at https://discord.gg/red if you plan on contributing.
Thanks! I'll also take a look at other issues!
Behoben in
e96eefd27:[p]repo listlistet Repo-Ordner, die nicht geladen werden konnten, bereits auf.[p]repo adderklärt jetzt in diesem Fall, dass ein Ordner mit dem Namen existiert, aber kaputt ist, und dass man ihn aus dem Repos-Ordner (Pfad wird angezeigt) entfernen und das Repo neu hinzufügen kann.Generated by Claude Code