makeplane/plane · error · ValidationError
File too large. Size should not exceed 5 MB.
Error message
File too large. Size should not exceed 5 MB.
What it means
Django ValidationError raised by the `file_size` validator attached to `FileAsset` fields when an uploaded file's byte size exceeds `settings.FILE_SIZE_LIMIT`. The default limit is 5242880 bytes (5 MiB) per common.py:353, set from the `FILE_SIZE_LIMIT` env var. The message hardcodes '5 MB' even though the real limit is configurable.
Source
Thrown at apps/api/plane/db/models/asset.py:28
from django.core.exceptions import ValidationError
from django.db import models
# Module import
from plane.utils.path_validator import sanitize_filename
from .base import BaseModel
def get_upload_path(instance, filename):
filename = sanitize_filename(filename) or uuid4().hex
if instance.workspace_id is not None:
return f"{instance.workspace.id}/{uuid4().hex}-{filename}"
return f"user-{uuid4().hex}-{filename}"
def file_size(value):
if value.size > settings.FILE_SIZE_LIMIT:
raise ValidationError("File too large. Size should not exceed 5 MB.")
class FileAsset(BaseModel):
"""
A file asset.
"""
class EntityTypeContext(models.TextChoices):
ISSUE_ATTACHMENT = "ISSUE_ATTACHMENT"
ISSUE_DESCRIPTION = "ISSUE_DESCRIPTION"
COMMENT_DESCRIPTION = "COMMENT_DESCRIPTION"
PAGE_DESCRIPTION = "PAGE_DESCRIPTION"
USER_COVER = "USER_COVER"
USER_AVATAR = "USER_AVATAR"
WORKSPACE_LOGO = "WORKSPACE_LOGO"
PROJECT_COVER = "PROJECT_COVER"
DRAFT_ISSUE_ATTACHMENT = "DRAFT_ISSUE_ATTACHMENT"
DRAFT_ISSUE_DESCRIPTION = "DRAFT_ISSUE_DESCRIPTION"View on GitHub (pinned to 1c8a60f858)
Solutions
- Reduce the file below `FILE_SIZE_LIMIT` bytes (default 5 MiB) before uploading.
- Raise the limit in your environment: set `FILE_SIZE_LIMIT=<bytes>` (e.g. 10485760 for 10 MiB) and restart the API; remember DATA_UPLOAD_MAX_MEMORY_SIZE is bound to the same env var (common.py:371).
- Compress/resize images or split large attachments before upload.
- If surfacing to users, read `settings.FILE_SIZE_LIMIT` dynamically rather than trusting the hardcoded '5 MB' text.
Example fix
# before (env) FILE_SIZE_LIMIT=5242880 # after - allow 10 MiB FILE_SIZE_LIMIT=10485760
Defensive patterns
Strategy: validation
Validate before calling
from django.conf import settings
def under_limit(uploaded_file) -> bool:
# mirrors asset.py:27 file_size validator
return getattr(uploaded_file, 'size', 0) <= settings.FILE_SIZE_LIMIT Try / catch
from django.core.exceptions import ValidationError
try:
asset.full_clean()
except ValidationError as e:
if 'File too large' in str(e):
# surface the configured limit, not the hardcoded '5 MB'
return bad_request(f'Exceeds {settings.FILE_SIZE_LIMIT} bytes') Prevention
- Read settings.FILE_SIZE_LIMIT at runtime; do not trust the '5 MB' message text.
- Check size client-side before upload and again server-side.
- Remember FILE_SIZE_LIMIT also bounds DATA_UPLOAD_MAX_MEMORY_SIZE.
When it happens
Trigger: Uploading a workspace logo, page/issue/comment description asset, or any FileAsset-bound file larger than `FILE_SIZE_LIMIT`. The validator fires during model full_clean / form/serializer validation when `value.size` is read from the stored upload.
Common situations: Default deployment where FILE_SIZE_LIMIT is unchanged (5 MiB) and a user uploads a high-res image or PDF; raising FILE_SIZE_LIMIT in env but the message still says '5 MB'; uploads that pass the presigned-URL size check (which clamps client size) but the actual stored object is larger.
Related errors
- File too large. Size should not exceed 5 MB.
- Invalid file type. Please select an image.
- Missing required fields.
- Invalid expression: empty or null data
- AND group must contain at least one condition
AI-assisted analysis of makeplane/plane@1c8a60f858 (2026-08-12).
Data as JSON: /api/errors/f597408f16808a1d.
Report an issue: GitHub.