Skip to content

Cargo internal error when downloading crate from git via ssh #16076

@tk16262

Description

@tk16262

Problem

I have a forked copy of a crate stored in a local gitlab instance and added in my Cargo.toml as prometheus_exporter = { git = "ssh://git@<url>/libraries.git", branch = "main" }.

Sometimes when compiling I get this error:

error: failed to download `prometheus_exporter v0.8.5 (ssh://git@<url>/libraries.git?branch=main#54abbe8c)`
Caused by:
  unable to get packages from source
Caused by:
  failed to find prometheus_exporter v0.8.5 (ssh://git@<url>/libraries.git?branch=main#54abbe8c) in path source
note: this is an unexpected cargo internal error
note: we would appreciate a bug report: https://github.com/rust-lang/cargo/issues/
note: cargo 1.90.0 (840b83a10 2025-07-30)

Sometimes it compiles and runs without issue. Sometimes when it has already been compiled and I run cargo run, the same error occurs.

Steps

  1. Run cargo --config net.git-fetch-with-cli=true run

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.90.0 (840b83a10 2025-07-30)
release: 1.90.0
commit-hash: 840b83a10fb0e039a83f4d70ad032892c287570a
commit-date: 2025-07-30
host: x86_64-unknown-linux-gnu
libgit2: 1.9.1 (sys:0.20.2 vendored)
libcurl: 8.14.1-DEV (sys:0.4.82+curl-8.14.1 vendored ssl:OpenSSL/3.5.0)
ssl: OpenSSL 3.5.0 8 Apr 2025
os: Ubuntu 24.4.0 (noble) [64-bit]

and

cargo 1.90.0 (840b83a10 2025-07-30)
release: 1.90.0
commit-hash: 840b83a10fb0e039a83f4d70ad032892c287570a
commit-date: 2025-07-30
host: x86_64-unknown-linux-gnu
libgit2: 1.9.1 (sys:0.20.2 vendored)
libcurl: 8.14.1-DEV (sys:0.4.82+curl-8.14.1 vendored ssl:OpenSSL/3.5.0)
ssl: OpenSSL 3.5.0 8 Apr 2025
os: Arch Linux [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-gitArea: anything dealing with gitC-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions