Rate limit error
Type: Bug
I work for an org with github integrated SSO. I have a VS code session locally that was logged in 5 weeks ago, but holidays happened and I didn't touch my company repos during that time - though I did do personal coding.
For some reason today, trying to create my first PR to company repos since the holidays, githib PR showed me a 'log into github' form.
But down the bottom under accounts, it showed me logged into github with the correct username.
Clicking on the sign in button in the PR side window, nothing happened.
I then used the accounts button to sign out, after which the sign in button brought up my browser, which I then logged into just fine. The link and bounce back to vscode however errored: vscode got
[Info - 12:18:25.102] Getting sessions for read:user,repo,user:email,workflow...
[Info - 12:18:25.102] Got 0 sessions for read:user,repo,user:email,workflow...
[Info - 12:18:25.147] Getting sessions for read:user,repo,user:email...
[Info - 12:18:25.147] Got 0 sessions for read:user,repo,user:email...
[Info - 12:18:25.173] Getting sessions for read:user,repo,user:email,workflow...
[Info - 12:18:25.173] Got 0 sessions for read:user,repo,user:email,workflow...
[Info - 12:18:26.952] Logging in for the following scopes: read:user repo user:email workflow
[Info - 12:18:26.959] Trying without local server... (read:user repo user:email workflow)
[Trace - 12:18:33.367] Handling Uri...
[Info - 12:18:33.367] Exchanging code for token...
[Info - 12:18:33.666] Token exchange success!
[Info - 12:18:33.666] Getting user info...
[Error - 12:18:33.874] Getting account info failed: API rate limit exceeded for user ID xxx.
[Error - 12:18:33.874] Error: API rate limit exceeded for user ID xxx.
Extension version: 0.48.0 VS Code version: Code 1.70.1 (6d9b74a70ca9c7733b29f0456fd8195364076dda, 2022-08-10T06:08:33.642Z) OS version: Windows_NT x64 10.0.22000 Modes: Remote OS version: Linux x64 5.13.0-52-generic Remote OS version: Linux x64 5.13.0-52-generic Remote OS version: Linux x64 5.13.0-1031-azure
System Info
| Item | Value |
|---|---|
| CPUs | AMD Ryzen Threadripper 2990WX 32-Core Processor (64 x 2994) |
| GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_renderer: enabled_on video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled |
| Load (avg) | undefined |
| Memory (System) | 127.87GB (64.17GB free) |
| Process Argv | --crash-reporter-id d9f3c32e-60ca-4766-805a-fb437a111084 |
| Screen Reader | no |
| VM | 0% |
| Item | Value |
|---|---|
| Remote | SSH: tr2vm |
| OS | Linux x64 5.13.0-52-generic |
| CPUs | AMD Ryzen Threadripper 2990WX 32-Core Processor (64 x 2994) |
| Memory (System) | 8.00GB (2.34GB free) |
| VM | 0% |
| Item | Value |
|---|---|
| Remote | SSH: tr2vm |
| OS | Linux x64 5.13.0-52-generic |
| CPUs | AMD Ryzen Threadripper 2990WX 32-Core Processor (64 x 2994) |
| Memory (System) | 8.00GB (2.34GB free) |
| VM | 0% |
| Item | Value |
|---|---|
| Remote | SSH: cognite-lifeless |
| OS | Linux x64 5.13.0-1031-azure |
| CPUs | AMD Ryzen Threadripper 2990WX 32-Core Processor (32 x 2994) |
| Memory (System) | 17.22GB (3.76GB free) |
| VM | 0% |
A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383:30185418
vspor879:30202332
vspor708:30202333
vspor363:30204092
vstes627cf:30244335
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonvspyt551cf:30345471
pythonptprofiler:30281270
vshan820:30294714
vstes263cf:30335440
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30410667
wslgetstarted:30449410
cppdebug:30492333
vscaat:30438848
pylanb8912cf:30529770
vsclangdc:30486549
c4g48928:30535728
d7fjc500:30543455
dsvsc012cf:30540253
@rbtcollins do you remember if you reloaded VS Code or opened many VS Code windows right before this error occurred?
I think it might have just done an upgrade?
hmm, ok. We fetch a lot of data from GitHub after reload, so I was thinking that could be part of the problem. I've started seeing the rate limit this week too though. I'll add some new logging around the rate limit and we'll see what we can learn.
I started getting a lot of notifications for API rate limit exceeded for user ID 131#### (masked) this week.
I would like to provide any logs if I can on this. Please let me know how/where to add them and I will.
Saw this happening 3 times for me this week, this is quite a blocker.
I've reached out to the GitHub folks to ask about the rate limit. Will keep this thread updated.
We've seen this happening more frequently since https://github.com/microsoft/vscode-pull-request-github/releases/tag/v0.50.0.
I've reached out to the GitHub folks to ask about the rate limit.
May I ask, what exactly is the ask about the rate limit?
Sure:
- What is the rate limit for an authenticated user? Edit: seems to be 5,000, which I still don't think we're hitting.
- Unless it's quite low, I doubt we're actually hitting it. What could be causing this?
GitHub API rate limit is well measurable during interaction flows. Basically, each API response contains the x-ratelimit-remaining number, which could be tracked to provider a better monitoring tool for individual user. That said, if that PR extension would log this number in Output channel periodically, one could observe usage.
@AlexTugarev indeed, I have used the header values and the graphql rate limit response values to add some practical rate limit logging to the extension.
Folks who see this issue and use the pre-release version of the extension: please share the output from "GitHub Pull Request" when you hit the issue. There are logs in the latest pre-release version that will help me understand what's happening.
Folks who see this issue and use the pre-release version of the extension: please share the output from "GitHub Pull Request" when you hit the issue. There are logs in the latest pre-release version that will help me understand what's happening.
Sweet, here you go:
[Info] Review> switch to Pull Request #531 - start
[Info] Review> Review> switch to Pull Request #531 - done
[Info] Review> Queuing additional validate state
[Info] Review> Validating state...
[Info] Found GitHub remote
[Info] GithubRepository> Unable to fetch issues: Error: GraphQL error: API rate limit exceeded for user ID 372.
[Info] GithubRepository> Unable to fetch issues with query: Error: GraphQL error: API rate limit exceeded for user ID 372.
[Info] GithubRepository> Unable to fetch issues with query: Error: GraphQL error: API rate limit exceeded for user ID 372.
[Info] GithubRepository> Unable to fetch issues: Error: GraphQL error: API rate limit exceeded for user ID 372.
[Info] GithubRepository> Unable to fetch issues with query: Error: GraphQL error: API rate limit exceeded for user ID 372.
[Info] GithubRepository> Unable to fetch issues with query: Error: GraphQL error: API rate limit exceeded for user ID 372.
[Info] GithubRepository> Unable to fetch issues without milestone: Error: GraphQL error: API rate limit exceeded for user ID 372.
[Info] Error: GraphQL error: API rate limit exceeded for user ID 372.
[Info] Failed to get pull request review comments: Error: GraphQL error: API rate limit exceeded for user ID 372.
[Info] GithubRepository> Unable to fetch issues without milestone: Error: GraphQL error: API rate limit exceeded for user ID 372.
[Info] GithubRepository> Unable to fetch issues with query: Error: GraphQL error: API rate limit exceeded for user ID 372.
[Info] GithubRepository> Unable to fetch issues with query: Error: GraphQL error: API rate limit exceeded for user ID 372.
[Info] Review> current branch pr/TimothyBaumgartner/531 is associated with pull request #531
[Info] Review> Resolving pull request
[Info] GithubRepository> Unable to fetch PR: Error: GraphQL error: API rate limit exceeded for user ID 372.
[Info] PullRequestTree> Removing PR #undefined from tree
[Info] Review> This PR is no longer valid
[Info] Failed to get pull request review comments: Error: GraphQL error: API rate limit exceeded for user ID 372.
[Info] Error: GraphQL error: API rate limit exceeded for user ID 372.
Let me know if there's anything else I can do to help.
@timothy-b thanks for the logs! Are you using the latest pre-release version of the extension (requires VS Code insiders)? None of the log lines I added are showing in there.
Hey guys,
I'm also experiencing the issue with hitting the rate limit quite frequently in the last one or two weeks...
I'm using v0.50.0 which seems to have updated just today...
Last updated: 9/27/2022, 11:40:07
Here's the output I'm getting:
[Info] Registering git provider
[Info] Looking for git repository
[Info] Found 1 repositories during activation
[Info] Git repository found, initializing review manager and pr tree view.
[Info] Review> Validate state in progress
[Info] Review> Validating state...
[Info] Found GitHub remote
[Info] Review> current branch issue/cancel is associated with pull request #99
[Info] Review> Resolving pull request
[Info] Found GitHub remote
[Info] Error signing in to GitHub: HttpError: API rate limit exceeded for user ID XXXXXXX.
[Info] HttpError: API rate limit exceeded for user ID XXXXXXX.
at /Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1153:6173
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
at async I1.setCurrentUser (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1170:16820)
at async I1.createHub (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1170:18001)
at async I1.login (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1170:15990)
at async Um.authenticate (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1288:25131)
at async /Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1288:6901
at async c._executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:85:63762)
[Info] Error signing in to GitHub: HttpError: API rate limit exceeded for user ID XXXXXXX.
[Info] HttpError: API rate limit exceeded for user ID XXXXXXX.
at /Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1153:6173
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
at async I1.setCurrentUser (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1170:16820)
at async I1.createHub (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1170:18001)
at async I1.login (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1170:15990)
at async Um.authenticate (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1288:25131)
at async /Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1288:6901
at async c._executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:85:63762)
[Info] Error signing in to GitHub: HttpError: API rate limit exceeded for user ID XXXXXXX.
[Info] HttpError: API rate limit exceeded for user ID XXXXXXX.
at /Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1153:6173
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
at async I1.setCurrentUser (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1170:16820)
at async I1.createHub (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1170:18001)
at async I1.login (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1170:15990)
at async Um.authenticate (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1288:25131)
at async /Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1288:6901
at async c._executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:85:63762)
[Info] Error signing in to GitHub: HttpError: API rate limit exceeded for user ID XXXXXXX.
[Info] HttpError: API rate limit exceeded for user ID XXXXXXX.
at /Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1153:6173
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
at async I1.setCurrentUser (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1170:16820)
at async I1.createHub (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1170:18001)
at async I1.login (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1170:15990)
at async Um.authenticate (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1288:25131)
at async /Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1288:6901
at async c._executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:85:63762)
[Info] Error signing in to GitHub: HttpError: API rate limit exceeded for user ID XXXXXXX.
[Info] HttpError: API rate limit exceeded for user ID XXXXXXX.
at /Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1153:6173
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
at async I1.setCurrentUser (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1170:16820)
at async I1.createHub (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1170:18001)
at async I1.login (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1170:15990)
at async Um.authenticate (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1288:25131)
at async /Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1288:6901
at async c._executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:85:63762)
[Info] Error signing in to GitHub: HttpError: API rate limit exceeded for user ID XXXXXXX.
[Info] HttpError: API rate limit exceeded for user ID XXXXXXX.
at /Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1153:6173
at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
at async I1.setCurrentUser (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1170:16820)
at async I1.createHub (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1170:18001)
at async I1.login (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1170:15990)
at async Um.authenticate (/Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1288:25131)
at async /Users/alex/.vscode/extensions/github.vscode-pull-request-github-0.50.0/dist/extension.js:1288:6901
at async c._executeContributedCommand (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:85:63762)
I've redacted the user ID from the output...
And I should mention, I often do have multiple (2 to 3) VSCode instances open.
Glad to see I'm not alone. I thought "how could I possibly be hitting 5000 requests in an hour? I assume something is going wrong and causing an unusually high number of requests, but even after that is fixed it may be helpful for the extension to honor the x-ratelimit-reset header and let the user know how long they have to wait before they can do anything. Otherwise, it's a frustrating guessing game. The header gives the exact reset moment in Epoch time, according to this blog post: https://coderdiaries.com/github-error-rate-limit-exceeded/
Also, I tend to leave my computer on with VS Code running, but my computer crashed the other day because so many GitHub login dialog boxes had appeared overnight that my computer with 48 GB of RAM couldn't handle it. Yesterday, I witnessed a blast of dozens of login prompts appear in rapid succession. I couldn't close them quick enough to keep up, so I closed VS Code. Perhaps that is related to this bug. I was using the pre-release until my computer crashed and have been using the regular release since thince, but now that I've read this issue I'll opt back in and share the log if it happens again.
Found the cause via the logs provided in https://github.com/microsoft/vscode-pull-request-github/issues/4021.
I just noticed that this extension is working again! 🎉 Sorry I never got back to you, but thank you so much @alexr00!
Thanks for trying the extension out again @timothy-b!
Hi @alexr00, I still have this error using v0.54.1, is the fix included in this release?
On the 31th of October you wrote:
That bug is fixed in the pre-release build of this extension, which requires that you use VS Code insiders. The fix will be in the next stable release too (should occur later this week).
Since there were 2 releases (v0.54.0 and v0.54.1) but I don't see the fix listed in the changelog. I cannot update to VSCode Insiders unfortunately.
edit: I was able to switch to GPRI pre-release version (v0.55.2022112112) and indeed the bug is fixed! Thank you so much. So I guess the fix is not included in v0.54.1. Note that it is not needed to have VSCode Insiders (I just clicked a button "switch to pre-release version" in VSCode on the Extension page).
@xididri the rate limit error fix is in v0.54.1. If you're still seeing the error there then please set "githubPullRequests.logLevel": "debug", wait for the next time the error occurs, then share the output from "GitHub Pull Request" in an issue!
Ok weird. Indeed I switched back to stable release v0.54.1, reloaded, signed out, signed back in and saw no error. Thanks again!
I'm still facing the rate limit error in v0.78.1
API rate limit exceeded for user ID xxxx.
Log
2023-12-19 13:41:07.286 [debug] CreatePullRequestViewProvider> Creating pull request with args {"title":"xxxx","body":"xxxx","owner":"xxxx","repo":"xxxx","base":"master","compareBranch":"xxxx","compareOwner":"xxxx","compareRepo":"xxxx","draft":false,"autoMerge":false,"labels":[],"assignees":[],"reviewers":[]}
2023-12-19 13:41:07.298 [debug] GitHubRepository> Create pull request - enter
2023-12-19 13:41:07.299 [debug] GitHubRepository> Fetch metadata - enter
2023-12-19 13:41:07.299 [debug] GitHubRepository> Fetch metadata xxxx/xxxxx - done
2023-12-19 13:41:07.300 [debug] RateLimit> Extension rate limit remaining: 140, undefined
2023-12-19 13:41:07.796 [error] GitHubRepository> Unable to create PR: Error: GraphQL error: API rate limit exceeded for user ID xxxx.
2023-12-19 13:41:07.798 [error] FolderRepositoryManager+13> Creating pull requests failed: Error: GraphQL error: API rate limit exceeded for user ID xxxx.
2023-12-19 13:43:09.219 [debug] RateLimit> Extension rate limit remaining: 140, /repos/{owner}/{repo}/compare/{base}...{head}
2023-12-19 13:43:09.221 [debug] RateLimit> Extension rate limit remaining: 139, /repos/{owner}/{repo}/compare/{base}...{head}
2023-12-19 13:43:09.893 [debug] RateLimit> REST Rate limit remaining: 2595, /repos/{owner}/{repo}/compare/{base}...{head}
2023-12-19 13:43:09.899 [debug] RateLimit> REST Rate limit remaining: 2594, /repos/{owner}/{repo}/compare/{base}...{head}
I think it would be good if we had some button to open the GitHub PR creating page in the browser instead of creating it in the vscode
@PePoDev can you share some more of the logs before the point where the rate limit was exceeded? I'd like to understand what GitHub API we were using that caused this.
I found this log in many lines, I think it's related to the vscode that I open multiple repos in one instance and the plugin is reading the status for all of the repos until the rate limit exceeds
[error] RateLimit> API call count has exceeded 140 concurrent calls.
Anything like:
[debug] RateLimit> GraphQL Rate limit remaining
followed by a small number?