Skip to content

Hyphenated Crate Name Installation Fails #15158

Closed as not planned
Closed as not planned
@bericyb

Description

@bericyb

Problem

When installing crates such as "axum-extra" if the user enters "axum_extra" with an underscore, cargo shows the following warning:
warning: translating 'axum_extra' to 'axum-extra'

However, the installation fails due to a version not found error, even though the version was not specified.
error: the crate [email protected] could not be found in registry index. Notice [email protected] does not exist at the time of report.

Installation works just fine if the user enters 'axum-extra' with a hyphen instead of an underscore.
After a successful installation, running 'cargo add axum_extra' will update the proper 'axum-extra' crate.

In my small testing I can only reproduce this with axum-extra but not other hyphenated crates

Steps

mkdir bug-test && cd bug-test
cargo init
cargo add 'axum_extra' This will fail!
cargo add 'axum-extra' This will succeed!
cargo add 'axum_extra' This will succeed even with translation

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.84.1 (66221abde 2024-11-19)
release: 1.84.1
commit-hash: 66221abdeca2002d318fde6efff516aab091df0e
commit-date: 2024-11-19
host: aarch64-apple-darwin
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.7.1 (sys:0.4.74+curl-8.9.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Mac OS 15.3.0 [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-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