Leantime/leantime · error · Leantime\Core\Files\Exceptions\FileValidationException
1003
1003
Error message
File exceeds maximum allowed size
What it means
After constructing the UploadedFile, upload() compares $file['file']['size'] against FileManager::getMaximumFileUploadSize() (the effective PHP limit derived from ini settings) and throws FileValidationException with code 1003 (FILE_TOO_LARGE) for oversize files. Like the other FileValidationException paths, it is caught inside the method and returned as a user-facing message string — the caller sees a string return, not an exception.
Source
Thrown at app/Domain/Files/Services/Files.php:156
$this->authorize(FilesPermissions::UPLOAD, $targetProjectId);
}
// Non-project modules (user avatar, private, ...) have no project context and preserve prior
// behavior; their flows pin moduleId server-side (e.g. ProfileImage forces the session user's id).
try {
// Validate file type with the enhanced validator
$symfonyFile = new UploadedFile(
$file['file']['tmp_name'],
$file['file']['name'],
$file['file']['type'],
$file['file']['error'],
true
);
// Validate file size before processing
if ($file['file']['size'] > FileManager::getMaximumFileUploadSize()) {
throw new FileValidationException('File exceeds maximum allowed size', FileValidationException::FILE_TOO_LARGE);
}
} catch (FileValidationException $e) {
Log::warning('File validation failed: '.$e->getMessage());
return $e->getUserMessage();
}
try {
// Create a UploadedFile instance
$symfonyFile = new UploadedFile(
$file['file']['tmp_name'],
$file['file']['name'],
$file['file']['type'],
$file['file']['error'],
(bool) config('app.debug')
);
$leantimeFile = $this->fileManager->upload($symfonyFile, $disk);View on GitHub (pinned to 9a9f49f100)
Solutions
- Upload a smaller file (compress images, split archives)
- Raise the limits together: upload_max_filesize AND post_max_size in php.ini (plus any proxy client_max_body_size), then restart PHP-FPM
- Check the return value: is_string($result) means validation failed and the string is the message to show the user
Example fix
# before (php.ini) upload_max_filesize = 2M post_max_size = 8M # after upload_max_filesize = 64M post_max_size = 68M
Defensive patterns
Strategy: validation
Validate before calling
$max = \Leantime\Core\Files\FileManager::getMaximumFileUploadSize();
if ($file['file']['size'] > $max) {
// upload() would return the FILE_TOO_LARGE message string
return ['error' => "File exceeds the {$max} byte server limit"];
} Prevention
- Check file size in the browser before POSTing (File.size against the server limit exposed to the client)
- Raise upload_max_filesize AND post_max_size (and proxy body limits) together when limits are too small
- Like other FileValidationException paths, oversize files come back as a returned string — branch on is_string($result)
When it happens
Trigger: Uploading an attachment larger than the effective limit (the smallest of upload_max_filesize / post_max_size); raising the webserver or nginx client_max_body_size but not the PHP ini values; one request carrying several files whose combined size exceeds post_max_size.
Common situations: Default PHP limits (often 2M/8M) vs modern attachment sizes; Docker/managed-hosting images with small defaults; reverse-proxy body limits capping uploads before PHP sees them.
Related errors
AI-assisted analysis of Leantime/leantime@9a9f49f100 (2026-08-21).
Data as JSON: /api/errors/c797ef722b6736da.
Report an issue: GitHub.