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 on `IssueAttachment.asset` when the uploaded attachment exceeds `settings.FILE_SIZE_LIMIT` (default 5 MiB). The inline comment states the check is 'only for cloud hosted' but the code unconditionally compares `value.size` to the limit, so it fires in every deployment.

Source

Thrown at apps/api/plane/db/models/issue.py:395

    class Meta:
        verbose_name = "Issue Link"
        verbose_name_plural = "Issue Links"
        db_table = "issue_links"
        ordering = ("-created_at",)

    def __str__(self):
        return f"{self.issue.name} {self.url}"


def get_upload_path(instance, filename):
    filename = sanitize_filename(filename) or uuid4().hex
    return f"{instance.workspace.id}/{uuid4().hex}-{filename}"


def file_size(value):
    # File limit check is only for cloud hosted
    if value.size > settings.FILE_SIZE_LIMIT:
        raise ValidationError("File too large. Size should not exceed 5 MB.")


class IssueAttachment(ProjectBaseModel):
    attributes = models.JSONField(default=dict)
    asset = models.FileField(upload_to=get_upload_path, validators=[file_size])
    issue = models.ForeignKey("db.Issue", on_delete=models.CASCADE, related_name="issue_attachment")
    external_source = models.CharField(max_length=255, null=True, blank=True)
    external_id = models.CharField(max_length=255, blank=True, null=True)

    class Meta:
        verbose_name = "Issue Attachment"
        verbose_name_plural = "Issue Attachments"
        db_table = "issue_attachments"
        ordering = ("-created_at",)

    def __str__(self):
        return f"{self.issue.name} {self.asset}"

View on GitHub (pinned to 1c8a60f858)

Solutions

  1. Keep issue attachments under FILE_SIZE_LIMIT bytes (default 5242880).
  2. Increase FILE_SIZE_LIMIT in the environment to suit your team (note it also raises Django's DATA_UPLOAD_MAX_MEMORY_SIZE).
  3. Strip the misleading 'only for cloud hosted' comment if you maintain this fork, since the guard is unconditional.
  4. Link large files externally via the `external_source` field instead of uploading them.
Defensive patterns

Strategy: validation

Validate before calling

from django.conf import settings

def attachment_under_limit(file_obj) -> bool:
    # mirrors issue.py:394 (unconditional despite the 'cloud hosted' comment)
    return file_obj.size <= settings.FILE_SIZE_LIMIT

Try / catch

from django.core.exceptions import ValidationError
try:
    attachment.full_clean()
except ValidationError as e:
    handle_size_error(e)  # custom: surface settings.FILE_SIZE_LIMIT

Prevention

When it happens

Trigger: Attaching a file to an issue (`IssueAttachment`) whose size exceeds FILE_SIZE_LIMIT. The validator runs through the `validators=[file_size]` entry on the FileField at issue.py:397 whenever the field is validated.

Common situations: Users attaching screenshots, logs, or PDFs over 5 MiB to issues; self-hosted deployments that forget FILE_SIZE_LIMIT also gates DATA_UPLOAD_MAX_MEMORY_SIZE; confusion because the comment implies the check is skipped off-cloud when it is not.

Related errors


AI-assisted analysis of makeplane/plane@1c8a60f858 (2026-08-12). Data as JSON: /api/errors/03bd1519b6704744. Report an issue: GitHub.