Skip to content
Playground(another site)

bynk.http.limit_bad_max_file

Error A @limit maxFile or maxParts is not a positive Int literal.

On a @multipart route, @limit's maxFile caps the bytes of one file part and maxParts the number of parts. Each must be a positive Int literal: zero or a negative number would refuse every upload, and there is no size literal, so "5MB" is refused too. Write the count, as 5_000_000. limits { } has the same rule (bynk.http.limits_invalid_field), and so does maxBody (bynk.http.limit_bad_max_body).

Example

consumes bynk { File }
type Upload = { photo: File }
@multipart
@limit(maxBody: 5_000_000, maxFile: 0) // ✗ a positive byte count
on POST("/upload") (body: Upload) -> Effect[HttpResult[String]] by v: Visitor { … }
@multipart
@limit(maxBody: 5_000_000, maxFile: 1_000_000) // ✓
on POST("/upload") (body: Upload) -> Effect[HttpResult[String]] by v: Visitor { … }

In the Book

See also

  • Every code in its category, HTTP, on the diagnostic index.
  • bynk explain bynk.http.limit_bad_max_file shows the same from the installed toolchain, without a network.