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

  1. Free space by deleting unneeded assets (empty trash) and retry.
  2. Ask an admin to raise the user's quota (Admin UI → Users → Quota).
  3. Set the user's quota to null (unlimited) if appropriate.
  4. 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

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


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)