Skip to content

Cargo publish --dry-run doesn't warn on max upload size #16921

@mandeep

Description

@mandeep

Problem

I ran cargo publish --dry-run to see if a project would publish okay. All seemed well except for a compatibility warning, which I expected.

I would expect that the dry run would also warn that the package size is 20.1MiB since it's greater than the 10MiB limit. I didn't receive a warning until I tried running cargo publish.

Output of cargo publish --dry-run:

    Updating crates.io index
   Packaging viewimg v0.11.0 (C:\Users\Mandeep\Github\viewimg)
    Updating crates.io index
    Packaged 23 files, 20.1MiB (16.6MiB compressed)
   Verifying viewimg v0.11.0 (C:\Users\Mandeep\Github\viewimg)
   Compiling viewimg v0.11.0 (C:\Users\Mandeep\Github\viewimg\target\package\viewimg-0.11.0)
    Finished `dev` profile [optimized + debuginfo] target(s) in 2.10s
warning: the following packages contain code that will be rejected by a future version of Rust: image2 v0.11.3
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`
   Uploading viewimg v0.11.0 (C:\Users\Mandeep\Github\viewimg)
warning: aborting upload due to dry run

Output of cargo publish:

Caused by:
  the remote server responded with an error (status 413 Payload Too Large): max upload size is: 10485760

Steps

Try to run cargo publish --dry-run on a package larger than the 10MiB limit. A warning will not appear that the package size is too large.

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.95.0 (f2d3ce0bd 2026-03-21)
release: 1.95.0
commit-hash: f2d3ce0bd7f24a49f8f72d9000448f8838c4e850
commit-date: 2026-03-21
host: x86_64-pc-windows-msvc
libgit2: 1.9.2 (sys:0.20.4 vendored)
libcurl: 8.15.0-DEV (sys:0.4.83+curl-8.15.0 vendored ssl:Schannel)
os: Windows 10.0.26200 (Windows 11 Professional) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-interacts-with-crates.ioArea: interaction with registriesC-bugCategory: bugCommand-publishS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions