cargo-edit icon indicating copy to clipboard operation
cargo-edit copied to clipboard

`cargo upgrade` fails with private registry and with features w/ dependencies

Open rirze opened this issue 8 months ago • 3 comments

Hi there,

I work in an offline environment where I only have access to a private crates repository. My ~/.cargo/config.toml looks like this:

[source.crates-io]
replace-with = "my-private-mirror"

[source.my-private-mirror]
registry = "sparse+https//my-rust-registry/sparse/rust-index"

And my local Cargo.toml has dependencies with features like clap = { version = "4.5", features = ["derive"] }. But when I try to use cargo upgrade, it fails with

    Checking my_crate's dependencies
Error: trailing characters at line 1 column 498

When I remove features, and just use plain version, it succeeds. Is there some config I need to do in order to get this work nicely?

rirze avatar May 12 '25 21:05 rirze

That looks like a json error which would most likely be coming from the Index entry. However, the use of features shouldn't be making a difference in what we do.

As I don't have access to your private registry, I'd recommend upgrading to the latest version and checking the -vvvv output

epage avatar May 13 '25 08:05 epage

Gotcha, I see you updated the crate for extra logging-- thanks for doing that.

The private mirror I use takes an unreliable amount of time to pull in changes so it might be a day or two before I can get back to you with results.

rirze avatar May 13 '25 13:05 rirze

I can't paste from my offline environment into here, but the output is akin to:

TRACE cargo_edit::index] opening index entry for sparse+https://my-rust-registry/spare/rust-index/
TRACE reqwest::blocking::client] (TheadId(2)) start runtime::block_on
TRACE reqwest::blocking::wait] (TheadId(1)) park without timeout
TRACE cargo_edit::index] krate clap
DEBUG reqwest::connect] starting new connection: https://my-rust-registry/
<mixture of the following>
TRACE reqwest::blocking::wait] wait at most 30s
TRACE reqwest::blocking::wait] (ThreadId(1)) park timeout 29.9999996s
x1 TRACE cargo_edit::index] krate reqwest
x1 TRACE cargo_edit::index] krate futures
x1 TRACE cargo_edit::index] krate serde
<end mixture>
TRACE reqwest::blocking::client] closing runtime thread (TheadId(2))
TRACE reqwest::blocking::client] signaled close for runtime thread (TheadId(2))
TRACE reqwest::blocking::client] (TheadId(2)) Receiver is shutdown
TRACE reqwest::blocking::client] (TheadId(2)) end runtime::block_on
TRACE reqwest::blocking::client] (TheadId(2)) finished
TRACE reqwest::blocking::client] closed runtime thread (TheadId(2))

And then I see the same error I reported before:

Error: trailing characters on line 1 column 498

rirze avatar May 14 '25 13:05 rirze