immich-app/immich · error · BadRequestException
Quota has been exceeded!
Error message
Quota has been exceeded!
What it means
requireQuota enforces the per-user storage quota: if the user has quotaSizeInBytes set and the incoming file would push quotaUsageInBytes beyond it, uploadAsset throws BadRequestException('Quota has been exceeded!'). It is a deliberate capacity limit, not a bug.
Solutions
- Free space by deleting unneeded assets (empty trash) and retry.
- Ask an admin to raise the user's quota (Admin UI → Users → Quota).
- Set the user's quota to null (unlimited) if appropriate.
- Check the user's usage beforehand (GET /api/users/me) and skip uploads that would exceed the remaining space.
Example fix
// before
await upload(file); // fails at quota limit
// after
const me = await getUserInfo();
const remaining = (me.quotaSizeInBytes ?? Infinity) - me.quotaUsageInBytes;
if (file.size > remaining) throw new Error(`Skipping ${file.name}: only ${remaining} bytes of quota left`);
await upload(file); Defensive patterns
Strategy: validation
Validate before calling
const me = await getUserInfo();
const remaining = (me.quotaSizeInBytes ?? Infinity) - me.quotaUsageInBytes;
if (file.size > remaining) throw new Error(`Quota exceeded: need ${file.size}, have ${remaining}`); Try / catch
try { await upload(file); } catch (e) { if (String(e).includes('Quota has been exceeded')) notifyUserToFreeSpaceOrUpgrade(); else throw e; } Prevention
- Check remaining quota before each upload, especially batch uploads
- Sort uploads small-first so partial batches still fit
- Periodically empty trash to reclaim quota
- Set quota to unlimited for backup-automation accounts
When it happens
Trigger: POST /api/assets where quotaSizeInBytes !== null and quotaSizeInBytes < quotaUsageInBytes + file.size for the authenticated user.
Common situations: Free-tier or restricted accounts uploading large videos; backup tools bulk-syncing an entire library against a small quota; shared-link uploads consuming another user's quota.
Understand the failure class
Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.
Related errors
- Invalid backup name!
- Unable to process profile image
- Unsupported file type
- Asset does not have valid dimensions
- Asset not found
AI-assisted analysis of immich-app/immich@e55ac299a4 (2026-09-15).
Data as JSON: /api/errors/f746026fbda586bf.
Report an issue: GitHub.
Appendix: source
Thrown at server/src/services/asset-media.service.ts:370
}
const album = await this.albumRepository.getById(sharedLink.albumId, { withAssets: false });
if (!album) {
return;
}
await this.albumRepository.addAssetIds(album.id, [assetId]);
const userIds = album.albumUsers.map(({ user }) => user.id);
await this.eventRepository.emit('AlbumUpdate', {
id: album.id,
userIds,
recipientIds: userIds,
});
}
private requireQuota(auth: AuthDto, size: number) {
if (auth.user.quotaSizeInBytes !== null && auth.user.quotaSizeInBytes < auth.user.quotaUsageInBytes + size) {
throw new BadRequestException('Quota has been exceeded!');
}
}
}
View on GitHub (pinned to e55ac299a4)