Skip to content
Latchkey

cargo publish "crate version is already uploaded" in CI

crates.io already has the version you are publishing, and crate versions can never be overwritten. The release must carry a new version number in Cargo.toml.

What this error means

cargo publish fails with "error: failed to publish to registry at https://crates.io" and a caused-by line "the remote server responded with an error (status 200 OK): crate version X.Y.Z is already uploaded".

cargo
error: failed to publish to registry at https://crates.io

Caused by:
  the remote server responded with an error (status 200 OK): crate version `1.3.0` is already uploaded

Common causes

The version in Cargo.toml was not bumped

CI published a version that already exists on crates.io. Versions are permanent, so the registry rejects the re-publish.

A duplicated or retried release job

A re-run of a release that already succeeded tries to publish the same version a second time.

How to fix it

Bump the version and publish

  1. Increment version in Cargo.toml.
  2. Commit and tag the new version.
  3. Run cargo publish against the new version.
Terminal
# in Cargo.toml: version = "1.3.1"
cargo publish

Skip the publish if the version already exists

Guard CI so a re-run does not attempt to republish a version that is already on crates.io.

Terminal
cargo publish --dry-run && cargo publish || echo "already published"

How to prevent it

  • Publish only from tagged releases with a fresh version.
  • Automate the version bump as part of the release.
  • Treat crates.io versions as immutable; never reuse a number.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →