ARTIFACTORY: Why does cargo publish fail with 415 Unsupported Media Type on cargo 1.96+

Products
Frog_Artifactory
Content Type
Use_Case
AuthorFullName__c
Omri Otmazgin, Alec Choy
articleNumber
000007015
FirstPublishedDate
2026-06-23T13:27:02Z
lastModifiedDate
2026-08-09

ARTIFACTORY: Why does cargo publish fail with 415 Unsupported Media Type on cargo 1.96+

Issue
Running cargo publish against a Cargo repository fails with an HTTP 415:
error: failed to publish <CRATE_NAME> <VERSION> to registry at
https://<JFROG_BASE_URL>/artifactory/api/cargo/<REPO_KEY>

Caused by:
  failed to get a 200 OK response, got 415
  body:
  {
    "errors" : [ {
      "status" : 415,
      "message" : "Unsupported Media Type"
    } ]
  }
The same repository and the same credentials work when the publish is run from cargo 1.95 or earlier.


Environment
  • Artifactory Self-Managed, on a version earlier than 7.146.22 or earlier than 7.133.23
  • cargo 1.96.0 or later


Cause
Cargo 1.96.0 changed the publish request to always send a Content-Type: application/octet-stream header. Earlier cargo versions sent no Content-Type at all.
On affected versions, the crate publish endpoint rejects a request that declares a content type other than multipart/form-data. It accepts a request that declares none, which is why every cargo release before 1.96 worked against the same endpoint without ever sending multipart.
Artifactory does receive the request and rejects it at the endpoint, so artifactory-request.log records it with status 415:
PUT|/api/cargo/<REPO_KEY>/api/v1/crates/new|415|1188|87|5|cargo/1.97.1
This was fixed under RTDEV-90290.


Resolution
  1. Check the cargo version on the machine that runs the publish:
    Rust
    cargo --version
    If it reports 1.96.0 or later, this article applies.
  2. Check the running Artifactory version:
    Shell
    GET https://<JFROG_BASE_URL>/artifactory/api/system/version
  3. Upgrade Artifactory to a version that contains the fix: 7.146.22 or 7.133.23 and above.
  4. Pin the toolchain to cargo 1.95 as a temporary workaround. Add rust-toolchain.toml beside the crate's Cargo.toml:
     [toolchain]
     channel = "1.95"
    Confirm the pin took effect before publishing again, since a pin that fails to apply looks identical to the original failure:


Validation
Publish the crate again:
cargo publish --registry <REGISTRY_NAME>
The command completes without the 415 error, and the request log now shows the same PUT with status 200:
grep 'api/v1/crates/new' $JFROG_HOME/artifactory/var/log/artifactory-request.log
Confirm the crate is stored in the repository:
jf rt search "<REPO_KEY>/crates/<CRATE_NAME>/*"


References