Today I was publishing one of my projects called cargo-blinc. You can find the code here and the blog post here.

While publishing, I got the following error:

error: api errors (status 200 OK): max upload size is: 10485760

This is exactly what is says. API has a limit of the size of a crate you want to publish. Currently, it's set to 10 MB. You can check the size by doing cargo publish --dry-run. This command will simulate the publishing process, but won't publish your crate.

After it finishes, you can inspect the generated *.crate file inside target/package directory. You can list files included in the package using cargo package --list.

In my case, it turned out that most of the crate size was caused by the *.gif file which I used as a demo in my

People behind the Rust ecosystem proved a lot of times that the infrastructure and tooling around Rust is well though out. This time it's not an exception.

It turns out that the [package] section in Cargo.toml has an optional key which specifies files which can be excluded from the package.

The fix was as easy as:

exclude = ["res/demo.gif"]

You can find more info about this feature here.