cargo: Cargo download dependency failed "send: no filter connected"

Problem

Cargo download dependency failed

This issue I filed on rust forum before, But I didn’t get enough useful information.


Edited by a maintainer

The error may look like:

% cargo t -v

**error****:** failed to download from `https://crates.io/api/v1/crates/zstd-sys/2.0.7+zstd.1.5.4/download`

Caused by:

[2] Failed initialization ([CONN-1-0] send: no filter connected)

This is due to a bug in some bad versions of libcurl, whose HTTP/2 multiplexing is not compatible with http proxy settings. The affected versions are:

  • 7.87.0
  • 7.88.0
  • 7.88.1

If you’re on macOS and your system libcurl is included, we suggest

  • either using Rust version 1.71, beta-2023-06-09, nightly-2023-06-11 or newer
  • or disabling http.multiplexing manually in .cargo/config.toml or CARGO_HTTP_MULTIPLEXING=false.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 37 (12 by maintainers)

Commits related to this issue

Most upvoted comments

It looks like a bug mostly for macOS since it’s shipped with curl v7.88.1 on the latest Ventura 13.4. And curl v7.88.1 has some bugs mentioned in https://github.com/rust-lang/cargo/issues/11746. For me CARGO_HTTP_MULTIPLEXING=false solves the problem.

Hi, all!

The beta backport of #12234 just got merged — https://github.com/rust-lang/rust/pull/112421. If everything goes well, rustc 1.71.0-beta.3 or some version should include that fix. I’ll let you know once it comes to live. Thank you!

Hello everyone. The fix should be available in beta-2023-06-09. Please rustup install beta-2023-06-09 and test it with cargo +beta-2023-06-09 <subcommand>. Thanks 😃

I hear you - but I doubt that updated crates being installed via cargo install-update would’ve been already present in the local cache…

It depends. Some .crate files might be downloaded already and stored in ~/.cargo/registry/cache

Is there anything we (I - via local config, or you - via cargo sources) can do to remedy this?

I am collecting information and working on a possible workaround. Please help confirm whether CARGO_HTTP_MULTIPLEXING=false works for you.

@mouse07410 That is because you have added the PATH of curl 8.1.2 to your shell. However, for libcurl, I doubt whether cargo will follow any of the environment variable suggests. I guess it uses the OS-default curl directly, whose version is 7.88.1.

I’m on the latest MacOS, and observe the same problem. It manifest itself with a few crates, but not with all of them - which is surprising to me.

I have correctly configured proxy, which works for Git and everything else. My curl is 8.1.2 - latest stable, installed via Macports.

I haven’t tried yet CARGO_HTTP_MULTIPLEXING=false

@XOR-op @weihanglo Thanks, CARGO_HTTP_MULTIPLEXING=false worked.

I set the mirror source: `[source.crates-io] replace-with = ‘ustc’

[source.ustc] registry = “git://mirrors.ustc.edu.cn/crates.io-index”`

and finally solve the problem with unset proxy in zsh (registry ustc): `export http_proxy=

export https_proxy=`

and

`export HTTP_PROXY=

export HTTPS_PROXY=`

maybe this will help.