Cargo is gaining the ability to retry network failures


Now that rust-lang/cargo#2396 is merged Cargo will soon start attempting to retry what appears to be spurious network requests when they fail. This should get released with the next nightly soon!

One part about this PR is that we don’t want to just blindly retry random failures but rather only those that look like network failures. Along those lines only some errors actually trigger a retry, but the logic may be subtly wrong! If you see Cargo retry for an error that’s impossible to fix or not retry on an error it should fix, please file an issue against Cargo! Hopefully we have enough contextual information to add in these cases over time.

And as always, feel free to file any other bugs you have against Cargo you find :slight_smile:


This is cool. Is it possible to run it in a mode where it doesn’t try to do network requests at all?


Oh how I wish Cargo supported this. Sadly, it doesn’t (yet) -

This obstructs my coding often enough that I’m contemplating just hacking something in to create an ‘offline-only’ cargo binary. I’ll be delighted when it gets implemented for real.


Yes, Cargo will not hit the network if a Cargo.lock exists and you at some point ran the equivalent of cargo fetch.


Does it stay true if you have overridden a dependency to a local checkout?

The last time I tried to do so it was reaching git and index every time I issued cargo build and failing to start the build without Internet connection available.

I also can’t re-add a removed dependency without internet (even if the dependency already used recursively by other, already listed dependencies).

Are there any Rust developers in countries where Github is banned?


You’re probably unfortunately running into a bug in Cargo where path overrides are concerned