mattermost-community/focalboard · warning
request entity too large
Error message
request entity too large
What it means
ErrRequestEntityTooLarge indicates the uploaded file or request body exceeds the allowed size limit. handleUploadFile returns it when an uploaded file exceeds the configured MaxFileSize, and errorResponse translates it to HTTP 413. It protects the server from oversized uploads.
Source
Thrown at server/model/error.go:26
"strings"
mmModel "github.com/mattermost/mattermost/server/public/model"
pluginapi "github.com/mattermost/mattermost/server/public/pluginapi"
)
var (
ErrViewsLimitReached = errors.New("views limit reached for board")
ErrPatchUpdatesLimitedCards = errors.New("patch updates cards that are limited")
ErrInsufficientLicense = errors.New("appropriate license required")
ErrCategoryPermissionDenied = errors.New("category doesn't belong to user")
ErrCategoryDeleted = errors.New("category is deleted")
ErrBoardMemberIsLastAdmin = errors.New("cannot leave a board with no admins")
ErrRequestEntityTooLarge = errors.New("request entity too large")
ErrInvalidBoardSearchField = errors.New("invalid board search field")
)
// ErrNotFound is an error type that can be returned by store APIs
// when a query unexpectedly fetches no records.
type ErrNotFound struct {
entity string
}
// NewErrNotFound creates a new ErrNotFound instance.
func NewErrNotFound(entity string) *ErrNotFound {
return &ErrNotFound{
entity: entity,
}
}
func (nf *ErrNotFound) Error() string {View on GitHub (pinned to a84bbb65e3)
Solutions
- Reduce the file size or compress it before uploading
- Increase service settings (ServiceSettings.MaxFileSize and any proxy/file limits) in config.json and restart
- Check intermediary proxies (nginx client_max_body_size) match the app limit
Example fix
// before
maxFileSize := 5 * 1024 * 1024
// after
// config.json
"ServiceSettings": { "MaxFileSize": 52428800 } Defensive patterns
Strategy: validation
Validate before calling
file, header, err := r.FormFile("file")
if err == nil && header.Size > maxFileSize {
http.Error(w, "file too large", http.StatusRequestEntityTooLarge)
return
} Type guard
func isEntityTooLargeErr(err error) bool {
return errors.Is(err, model.ErrRequestEntityTooLarge)
} Try / catch
err := app.HandleUploadFile(...)
if errors.Is(err, model.ErrRequestEntityTooLarge) {
http.Error(w, err.Error(), http.StatusRequestEntityTooLarge)
return
} Prevention
- Check file size client-side before upload
- Keep ServiceSettings.MaxFileSize and proxy limits aligned
- Compress large assets before attaching to cards
When it happens
Trigger: POST /api/v1/boards/{boardID}/files (handleUploadFile) with a file larger than the server's MaxFileSize setting; any handler routing through errorResponse that detects an oversized entity.
Common situations: Uploading large design files/videos to cards; server MaxFileSize lowered or plugin proxy limits (proxy_* settings) smaller than expected; reverse proxies with their own body-size caps (client_max_body_size).
Related errors
- block fields size limit exceeded
- at least one board is required
- at least one block is required
- team ID cannot be empty
- board ids and patches need to match
AI-assisted analysis of mattermost-community/focalboard@a84bbb65e3 (2026-08-30).
Data as JSON: /api/errors/cdcf5ad392b65526.
Report an issue: GitHub.