cargo: unable to connect to index.crates.io

Problem

When attempting to download crates, I get a warning: spurious network error (3 tries remaining): [35] SSL connect error (Recv failure: Connection was reset). After the next tries it causes the install to fail with: Caused by: [35] SSL connect error (Recv failure: Connection was reset) This started happening on my new windows 11 machine.

Steps

Clean installation on a new windows 11 system, all updates installed. Attempting to install any crate fails.

Possible Solution(s)

No response

Notes

The toolchain used makes no difference. Already tried setting these options in the global config.toml, based on some previous issues: [source.crates-io] index = “https://github.com/rust-lang/crates.io-index” # I set the source to the official github index

[http] proxy = “” # leaving this as a blank string resets proxy to default http.check-revoke = false #check-revoke = false

None of which worked. I am not using Windows defender. I am using Eset antivirus as I was on my previous computer, where I didn’t have this problem.

Version

cargo 1.78.0-nightly (fc1d58fd0 2024-02-09)
release: 1.78.0-nightly
commit-hash: fc1d58fd0531a57a6b942a14cdcdbcb82ece16f3
commit-date: 2024-02-09
host: x86_64-pc-windows-msvc
libgit2: 1.7.2 (sys:0.18.2 vendored)
libcurl: 8.6.0-DEV (sys:0.4.71+curl-8.6.0 vendored ssl:Schannel)
os: Windows 10.0.22635 (Windows 11 Core) [64-bit]

About this issue

  • Original URL
  • State: open
  • Created 4 months ago
  • Reactions: 5
  • Comments: 20 (3 by maintainers)

Most upvoted comments

If someone is still going through this issue on Windows, please try by adding registries.crates-io.protocol = "git" to /.cargo/config.toml. It worked for me.

Not at all! I am on Linux and it is a DNS issue when building an image with a Rust App. On my host, everything works fine! It seems that in the Dockerfile, when cargo build is triggered, cargo update execute first to update the index with crates.io, and it is here I got the issue. Even more, the initial image is downloaded successfully!

Something is wrong with index.crates.io and their DNS …

If someone is still going through this issue on Windows, please try by adding registries.crates-io.protocol = "git" to /.cargo/config.toml. It worked for me.

I tried that before I found the workaround for me with ipv4 only. Getting the index worked. Downloading the crates didn’t work for me.