Body too large
Identifiers
Section titled “Identifiers”| Field | Value |
|---|---|
| Type URI | https://echo.labstack.com/pro/problems/body-too-large |
| Code | body_too_large |
| HTTP status | 413 |
| HTTP status | English title |
|---|---|
| 413 | Request Entity Too Large |
When it occurs
Section titled “When it occurs”The request body is larger than the server accepts. Either the Content-Length header or the bytes actually read exceeded the limit.
Client handling
Section titled “Client handling”Send a smaller body.
Example response
Section titled “Example response”If your application installs a custom handler, the body may differ.
HTTP/1.1 413 Request Entity Too LargeContent-Type: application/problem+json
{ "code": "body_too_large", "status": 413, "title": "Request Entity Too Large", "type": "https://echo.labstack.com/pro/problems/body-too-large"}Server correction
Section titled “Server correction”If the API must accept larger bodies, raise MaxBodyBytes before deployment. After the response starts, the server cannot replace it with a 413.
Response fields
Section titled “Response fields”OpenAPI middleware chain
Section titled “OpenAPI middleware chain”type(string, always): The exact type URI above.title(string, always): The HTTP status text.status(integer, always): The HTTP status of the response.detail(string, optional): Explanation text. Left out when empty.code(string, always): The stable code above.
Notes:
- The limit is
MaxBodyBytes(default 1 MiB). The default OpenAPIProblemHandlerwrites RFC 9457 JSON withtype,title,statusandcode. - The chain does not read the body before authentication. If auth finds the overflow, quota charges nothing. If quota already checked the request, the charge stays, subject to its settlement policy. A handler that reads only part of the body may not detect overflow.
- Once the response starts, the chain passes a
*BodyTooLargeErrortoOnError. It cannot replace the response with 413.
Your application (problem.NewError)
Section titled “Your application (problem.NewError)”type(string, always): The exact type URI above.title(string, always): The catalog title in the rendered language: English by default, Japanese only when the application selects it.status(integer, always): The HTTP status of the response.code(string, always): The stable code above.detail(string, optional): Display text that your application sets, up to 256 bytes withproblem.NewError. Omitted when you set none.
Headers:
Cache-Control(conditional):no-store, set byproblem/echoadapter.Content-Language(conditional):enorja, set byproblem/echoadapterfrom its configured language.
Notes:
- The adapter keeps existing
WWW-Authenticate,AllowandRetry-Afterheaders and adds no challenge or retry advice of its own. - On HEAD, the adapter’s
Content-Lengthequals the GET body’s length. - Return this code only when your body limiter rejected the request. Other 413 responses are not this problem.
Related behavior
Section titled “Related behavior”See the problem catalog for application error handling.