Potential red herring in error message with git dependencies
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
Problem
I put in the incorrect url to tokio-util (which is not currently published on crates.io. It's part of a workspace under tokio, I put:
tokio-util = { git = "https://github.com/tokio-rs/tokio-util" }
The error produced is:
❯ cargo build
Updating git repository `https://github.com/tokio-rs/tokio-util`
error: failed to load source for a dependency on `tokio-util`
Caused by:
Unable to update https://github.com/tokio-rs/tokio-util
Caused by:
failed to fetch into /home/evan/.cargo/git/db/tokio-util-b1e0f3693c77d8f8
Caused by:
failed to authenticate when downloading repository
attempted to find username/password via git's `credential.helper` support, but failed
Caused by:
failed to acquire username/password from local configuration
Those last 2 errors were confusing, I spent some time looking up .gitconfig credential helper and checked if ssh-agent was still running, etc. If you put in an incorrect URL, cargo will normally return a 404 error, but that's not what happened here. The first message given "unable to update" seems right, but all the rest is cryptic and had nothing to do with the error I was encountering (that I could tell)
Steps
- Use a url like
https://github.com/tokio-rs/tokio-utilforgit cargo build
Possible Solution(s)
Use a different error message. It looks like this should be a 404, I'm not sure why it wasn't.
Notes
It's possible I'm being a bit pedantic because the first error message does say "unable to update" which, while cryptic was the truest of the messages I got back. If you don't feel the messaging should be improved feel free to close this issue. However, I feel like the references to git's credential helper and username/password configuration are red herring's and could at least be removed in this case.
I'd be happy to have a look at cargo and try to improve the messaging if you like.
Output of cargo version:
cargo 1.40.0-nightly (5da4b4d47 2019-10-28)
rustc 1.40.0-nightly (1423bec54 2019-11-05)
Linux 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20) x86_64 GNU/Linux
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the reported git dependency failure with cargo build and the tokio-util URL shown in the issue. Trace how Cargo reports the failed repository update and credential-related errors, then determine how the message should distinguish this case from authentication problems; done means the output no longer sends users toward unrelated credential configuration.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100