{"record":{"id":"03bd1519b6704744","repo":"makeplane/plane","slug":"file-too-large-size-should-not-exceed-5-mb-03bd15","errorCode":null,"errorMessage":"File too large. Size should not exceed 5 MB.","messagePattern":"File too large\\. Size should not exceed 5 MB\\.","errorType":"validation","errorClass":"ValidationError","httpStatus":null,"severity":"error","filePath":"apps/api/plane/db/models/issue.py","lineNumber":395,"sourceCode":"    class Meta:\n        verbose_name = \"Issue Link\"\n        verbose_name_plural = \"Issue Links\"\n        db_table = \"issue_links\"\n        ordering = (\"-created_at\",)\n\n    def __str__(self):\n        return f\"{self.issue.name} {self.url}\"\n\n\ndef get_upload_path(instance, filename):\n    filename = sanitize_filename(filename) or uuid4().hex\n    return f\"{instance.workspace.id}/{uuid4().hex}-{filename}\"\n\n\ndef file_size(value):\n    # File limit check is only for cloud hosted\n    if value.size > settings.FILE_SIZE_LIMIT:\n        raise ValidationError(\"File too large. Size should not exceed 5 MB.\")\n\n\nclass IssueAttachment(ProjectBaseModel):\n    attributes = models.JSONField(default=dict)\n    asset = models.FileField(upload_to=get_upload_path, validators=[file_size])\n    issue = models.ForeignKey(\"db.Issue\", on_delete=models.CASCADE, related_name=\"issue_attachment\")\n    external_source = models.CharField(max_length=255, null=True, blank=True)\n    external_id = models.CharField(max_length=255, blank=True, null=True)\n\n    class Meta:\n        verbose_name = \"Issue Attachment\"\n        verbose_name_plural = \"Issue Attachments\"\n        db_table = \"issue_attachments\"\n        ordering = (\"-created_at\",)\n\n    def __str__(self):\n        return f\"{self.issue.name} {self.asset}\"\n","sourceCodeStart":377,"sourceCodeEnd":413,"githubUrl":"https://github.com/makeplane/plane/blob/1c8a60f858d8472aa56e29994ec1c7926da2c6ce/apps/api/plane/db/models/issue.py#L377-L413","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Keep issue attachments under FILE_SIZE_LIMIT bytes (default 5242880).","Increase FILE_SIZE_LIMIT in the environment to suit your team (note it also raises Django's DATA_UPLOAD_MAX_MEMORY_SIZE).","Strip the misleading 'only for cloud hosted' comment if you maintain this fork, since the guard is unconditional.","Link large files externally via the `external_source` field instead of uploading them."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from django.conf import settings\n\ndef attachment_under_limit(file_obj) -> bool:\n    # mirrors issue.py:394 (unconditional despite the 'cloud hosted' comment)\n    return file_obj.size <= settings.FILE_SIZE_LIMIT","typeGuard":null,"tryCatchPattern":"from django.core.exceptions import ValidationError\ntry:\n    attachment.full_clean()\nexcept ValidationError as e:\n    handle_size_error(e)  # custom: surface settings.FILE_SIZE_LIMIT","preventionTips":["Treat the limit as unconditional - the inline comment is misleading.","For large files, prefer the external_source field over uploading.","Keep attachment size under FILE_SIZE_LIMIT (default 5 MiB)."],"tags":["file-upload","validation","issue-attachment","file-size"],"backgroundTag":null,"analyzedSha":"1c8a60f858d8472aa56e29994ec1c7926da2c6ce","analyzedAt":"2026-08-12T14:44:31.636Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}