cant sync github repos

My repo is but can’t sync this repo… I click the sync button many times…

Did you delete the repository in GitHub and then re-create the fork? Because your repository has a new unique ID in GitHub. I can see it changed from 159660157 to 160291693. The repository ID no longer matches what is stored in Drone which is causing the problem (unique key violation in the database). So yea, sounds like an edge case … If you delete a repository and then re-create a repository with the same name, you get an error.

To resolve this you currently need to delete from repos where repo_slug = ? to remove the old repository, allowing the new repository to be synced. We will have a fix for this in the first minor release after 1.0 is complete.

Year, I recreated it, How to fix it… Could you help me delete it in the backend database.

I run into this issue also. This is also an issue on drone 0.8. To remove a repository completely from drone (so drone don’t know anything about this repo) i have to do some hackie stuff at the database. Can we have a simple way to remove a repository from drone?

Is there currently a workaround for this? On a selfhosted version i have control over the database but on i am pretty helpless. I don’t want to name a repo differently only to get back drone functionality.

EDIT: Ok found your answer here Missing repository after delete and re-fork.

It seems that this issue still exists in v1. I took a look at the Changelog and it seems like maybe it hasn’t been addressed yet? Does anyone know if it has been address or if editing the database directly is the correct way to resolve? Thanks

UPDATE: I have looked at my sqlite db and things look OK in there. I did not find any duplicate repos slugs. The missing repos in question are all forks so I’m wondering if there is a bug related to syncing forked repos. I do have at least one forked repo that does sync, however, so not all forks are missing.

I did not find any duplicate repos slugs.

You would not find any duplicate repos or slugs in the database because unique keys would prevent them from being inserted in the first place.

The reasons for a sync not working are well known and described in issue #2658 along with instructions to remove an offending repository using the API.

I reviewed the comments in the issue but still am not seeing the missing repos after syncing. I tried DELETE on the api and got

{ "message": "Not Found"}

for all the missing repos that I tried. I also confirmed that adding a new repo and forking a new repo in my org work properly in drone. Any other suggestions? I can try duplicating the repo as a next troubleshooting step but would rather not do that.

Drone handles forking fine. The problem is when a repository is forked, deleted, and then recreated under the same name (or some variant of deleting and renaming, or deleting and recreating with the same name). This results in conflicting repository identifiers (primary keys in the github database) and repository names.

If you think you have discovered another edge case it would be helpful to submit a unit test to the project that demonstrates the particular failure scenario. Relevant packages are and

In terms of the API you should have sysadmin role in Drone when invoking this endpoint.