#4168·actix-web

[actix-multipart] Generic "Payload error" when request exceeds size limit

Author: AverageHelperCreated Aug 1, 2026Updated Sep 15, 2026

Expected Behavior

The error message should describe the nature of the "payload error", such as "payload reached size limit" or "can not decode content-encoding".

Current Behavior

The plaintext error that appears to users is not actionable.

Possible Solution

Looking at the MultipartError enum, it seems the relevant details do exist on the Payload case, but the display attribute doesn't include them.

The simplest fix would probably be to add : {_0} to the end of the display attribute for this and other affected cases (such as Parse), such as in this playground. The DuplicateField, MissingField, and UnknownField cases already do something similar. I can draft a PR for this if need be. EDIT: This patch was rejected at https://github.com/actix/actix-web/pull/4186#pullrequestreview-4998119280 and reverted in 6a1feec593b9ecdfb6066b471582c3023b595141.

Alternatively, a custom error_response method at https://docs.rs/actix-multipart/latest/src/actix_multipart/error.rs.html#99 could work: one that walks the error tree to respond with something reasonable, even in cases where the Display impl must remain incomplete per official Rust idioms and guidelines.

In the meantime, users can work around this by match-ing against the error in a custom handler, and patch the output text that way.

Steps to Reproduce (for bugs)

  1. Set up an actix-web service with an endpoint that uses the actix_multipart::form::MultipartForm extractor.
  2. Try uploading a file that is slightly too large.
  3. Observe strange error.

See also this minimal repro: https://git.average.name/AverageHelper/actix_web_multipart_error_display_repro

Context

I'm trying to handle small image uploads for e.g. profile pictures, which typically don't need to be bigger than ~1 MiB. But even at the default total limit of 50 MiB, the default error should still be somewhat actionable IMO.

Your Environment

  • Rust Version: rustc 1.98.1 (48a229cea 2026-09-01)
  • Actix Web Version: 4.15.0