New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Failed to get latest version (HTTP code 403). #5753
Comments
I tried the command again about 5 minutes ago and it worked. And then tried again now and it failed again... All from the same machine |
Hmm... Tried again (running the command manually). Three servers that were failing earlier still failing (one started working briefly then stopped again) but two other servers (in another hosting) plus my dev server are OK. Is it possible we've been blocked for some reason? We don't do it that often - once per delivery per machine and we don't have that many internal machines (this is where it fails) although I guess they all seem to come from the same address. Is it just an ordinary HTTPS call? Need to check my firewalls |
@slarti-b My guess is that you're hitting GitHub's API rate limit. I believe they're based on IP address, so maybe there's some user code that's hitting the GitHub API too and using all of your requests. We do allow passing wp-cli/php/commands/src/CLI_Command.php Lines 407 to 410 in a71167e
When you see this error next, can you generate and pass a |
Thanks. Has the rate limit changed recently? This is a scripted deploy (we use ansible, so the deploy is the full machine config, and it always installs wp-cli and checks it's up-to-date). This has been running for some years (the wp-cli part certainly hasn't changed for a long time). And then yesterday this started. This morning I tried when i got in and had the same problem. Setting a token does make it work. So, follow-u questions
|
@slarti-b I have no idea
I think it just needs a basic "Read" scope. It's primarily used to indicate that the request is from an authenticated user.
See the GitHub docs. |
OK. Thanks. Will use the token.
and
One thing, though, is that I don't see any mention of the GITHUB_TOKEN option in the docs (would expect it here and here at least - are there any other commands that make github calls?) Should I log a separate issue somewhere else for the documentation, or leave this open? |
@slarti-b Thanks for capturing that here!
It would be great to include some mention in the docs for those commands. The docs are automatically generated from the codebase on each release. Want to submit a pull request with your suggested text? wp-cli/php/commands/src/CLI_Command.php Lines 246 to 259 in a71167e
wp-cli/php/commands/src/CLI_Command.php Lines 180 to 184 in a71167e
We could also include a more helpful error message when we detect that the failure is related to rate limiting: wp-cli/php/commands/src/CLI_Command.php Lines 412 to 416 in a71167e
|
Bug Report
The update command (
wp cli check-update
) fails withDescribe how other contributors can replicate this bug
wp cli check-update --allow-root
Describe what you expect as the correct outcome
I expect it either to update or report that it is already at latest
Let us know what environment you are running this on
CentOS 7
Provide a possible solution
Seems to have happened before - see #3853 - so guessing solution is similar. I first commented there, then noticed last post was a year ago and it was closed so opened a new one
The text was updated successfully, but these errors were encountered: