How to delete a published crate from crates.io?

  • A+
Category:Languages

I have accidentally published my private crate to crates.io. How do I delete it? I checked the documentation but it seems like there is no way to delete a published crate.

 


Prevention

To avoid this situation in the future, ensure that you include:

[package] # ... publish = false 

in your crate's Cargo.toml. See documentation.

Mitigation

Immediately yank the crate using:

cargo yank --vers <your-version> 

This will prevent any other crate to accidentally start depending on it.

If any secret was accidentally published (passwords, keys, ...), consider them no longer secret and take appropriate steps to replace them with fresh ones.

Removal

Contact help at crates.io and explain the situation, asking for removal.

If your explanation is well-founded, and the crate has not been downloaded and thus depended on, they have no reason to refuse helping.

Please be patient; once the crate is yanked nobody can start depending on it anyway, so there should be little time pressure. Give the team a few days to actually perform the removal.

If the matter is time sensitive for some reason, you can hop on IRC or Discourse and grab the attention of someone with the powers to perform the removal. Ask and you'll be directed to such a person.

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: