Github repo cannot be clone after some time with error "Repository not found"

I’m experiencing a weird problem when using Drone with Github. After some time (can be days to weeks) activating a Github repo on Drone, some repos failed at the clone step. The error is similar to this:

Initialized empty Git repository in /drone/src/.git/
+ git fetch origin +refs/heads/ISSUE-BRANCH:
remote: Repository not found.
fatal: repository '' not found

To solve this I had to disable and enable the repo in Drone again. But this problem already happened two or three times within the last two months for me.

Here’re the related logs that I could find in Drone server:

{"commit":"48ff53ac7c2502b7d9c6fe4a83411a934b5ab1fe","event":"pull_request","level":"info","msg":"trigger: skipping pipeline, does not match branch","pipeline":"develop","ref":"refs/pull/256/head","repo":"myorg/myrepo","time":"2021-01-14T08:50:46Z"}
{"commit":"48ff53ac7c2502b7d9c6fe4a83411a934b5ab1fe","error":"Not Found","event":"pull_request","level":"warning","msg":"trigger: cannot create status","pipeline":"develop","ref":"refs/pull/256/head","repo":"myorg/myrepo","time":"2021-01-14T08:50:46Z"}
{"":1884,"build.number":4,"error":"Not Found","level":"warning","msg":"manager: cannot publish status","":225,"":1892,"time":"2021-01-14T08:50:47Z"}
{"error":"stream: not found","level":"warning","msg":"manager: cannot teardown log stream","":7700,"":"check skip tests","step.status":"skipped","time":"2021-01-14T08:50:53Z"}
{"error":"stream: not found","level":"warning","msg":"manager: cannot teardown log stream","":7701,"":"docker","step.status":"skipped","time":"2021-01-14T08:50:53Z"}
{"error":"stream: not found","level":"warning","msg":"manager: cannot teardown log stream","":7702,"":"test","step.status":"skipped","time":"2021-01-14T08:50:53Z"}
{"error":"stream: not found","level":"warning","msg":"manager: cannot teardown log stream","":7703,"":"upload report","step.status":"skipped","time":"2021-01-14T08:50:53Z"}
{"":1884,"build.number":4,"error":"Not Found","level":"warning","msg":"manager: cannot publish status","":225,"":1892,"time":"2021-01-14T08:50:53Z"}

I’m not sure how to fix this. Please help to shed some light into the issue.

This indicates the github oauth2 access token is being revoked or is no longer valid. These are the only known root causes for the issue that you have described:

  1. the user that activates the repository has their repository (or organization) access revoked. Drone clones the repository on behalf of the user that activates it [1]. If the user no longer has access, Drone will be unable to clone the repository.
  2. the user that activates the repository revokes Drone’s oauth application authorization (via the github settings screen)

[1] Error on clone: Repository not found - #2 by bradrydzewski

If so it’s very strange in my case as the user who activated those repos still has access to them. He’s the one who reactivated the repos and then after some days the problem would happen again.
Is there a way we can get the token that was being used and verify that will Github manually? Like use it for an API call, or compare it with the one on Github (if Github ever shows that token on the UI).