[BUG] Uploading to a new album misses a few images/videos #1087

Closed
opened 2026-02-05 00:24:28 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @Caian on GitHub (Jul 11, 2023).

Originally assigned to: @jrasm91 on GitHub.

The bug

When uploading a large number of files (600+) to a newly created album, Immich fails to add some of the files to the album.

The files were uploaded successfully, as they appear in the "Photos" section, they just weren't added to the album itself.

The OS that Immich Server is running on

TrueNAS-SCALE-22.12.3.2, Intel N500, 16 GB LPDDR5 RAM

Version of Immich Server

v1.66.1

Version of Immich Mobile App

v1.66.1

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

Not using docker-compose

Your .env content

TYPESENSE_ENABLED=false
IMMICH_WEB_URL=http://immich_web:3000
IMMICH_SERVER_URL=http://immich_server:3001
IMMICH_MACHINE_LEARNING_URL=http://immich_machine_learning:3003
TZ=America/Sao_Paulo

Reproduction steps

1. Click "create new album"
2. On the new album panel, drag and drop (or choose to upload from computer) a large number of files (600+)
3. Wait for the upload to finish
4. Refresh and check the number of files in the album
...

Additional information

No response

Originally created by @Caian on GitHub (Jul 11, 2023). Originally assigned to: @jrasm91 on GitHub. ### The bug When uploading a large number of files (600+) to a newly created album, Immich fails to add some of the files to the album. The files were uploaded successfully, as they appear in the "Photos" section, they just weren't added to the album itself. ### The OS that Immich Server is running on TrueNAS-SCALE-22.12.3.2, Intel N500, 16 GB LPDDR5 RAM ### Version of Immich Server v1.66.1 ### Version of Immich Mobile App v1.66.1 ### Platform with the issue - [ ] Server - [X] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML Not using docker-compose ``` ### Your .env content ```Shell TYPESENSE_ENABLED=false IMMICH_WEB_URL=http://immich_web:3000 IMMICH_SERVER_URL=http://immich_server:3001 IMMICH_MACHINE_LEARNING_URL=http://immich_machine_learning:3003 TZ=America/Sao_Paulo ``` ### Reproduction steps ```bash 1. Click "create new album" 2. On the new album panel, drag and drop (or choose to upload from computer) a large number of files (600+) 3. Wait for the upload to finish 4. Refresh and check the number of files in the album ... ``` ### Additional information _No response_
OVERLORD added the 🖥️web label 2026-02-05 00:24:28 +03:00
Author
Owner

@alextran1502 commented on GitHub (Jul 12, 2023):

I think this is an issue with using the web app to upload many photos at the same time. For bulk upload I suggest to use the CLI as it is more resource friendly

@alextran1502 commented on GitHub (Jul 12, 2023): I think this is an issue with using the web app to upload many photos at the same time. For bulk upload I suggest to use the CLI as it is more resource friendly
Author
Owner

@alextran1502 commented on GitHub (Jul 12, 2023):

related to #3166. Thank you for reporting

@alextran1502 commented on GitHub (Jul 12, 2023): related to #3166. Thank you for reporting
Author
Owner

@Caian commented on GitHub (Jul 12, 2023):

I started uploading a few images at a time (around 10) and every once in a while, one or two images are not added to the album, so I have to open the full timeline and go look for it.

I see that upload notifications quickly pile up when uploading, so maybe the server is being overrun? I looked at the postgres logs, but haven't noticed anything wrong.

@Caian commented on GitHub (Jul 12, 2023): I started uploading a few images at a time (around 10) and every once in a while, one or two images are not added to the album, so I have to open the full timeline and go look for it. I see that upload notifications quickly pile up when uploading, so maybe the server is being overrun? I looked at the postgres logs, but haven't noticed anything wrong.
Author
Owner

@valonsodev commented on GitHub (Aug 31, 2023):

This is most likely a race condition in immich/server/src/domain/album/album.service.ts > addAssets.
Found this while looking for a way to batch requests to add assets to an album.
You can easily reproduce this:

  1. Send a PUT request to the album endpoint with the following payload {"ids":[<VALID_ASSET_ID_HERE>, <10_THOUSAND_RANDOM_UUIDS_HERE>]}
  2. Add to album normally immediately after

When Nº 1 finishes, reload the album, you should see now that only 1 or 2 assets appear in the album.

The endpoint first loads the album with the assets, then processes the incoming IDs to then finally save the changes with the new album assets. If the album assets change because of another request during this period those changes will get overwritten.
The easiest fix is to send a single request to the album with all asset IDs after uploading them all but if the upload stops midway for whatever reason no assets will get added.

@valonsodev commented on GitHub (Aug 31, 2023): This is most likely a race condition in immich/server/src/domain/album/album.service.ts > addAssets. Found this while looking for a way to batch requests to add assets to an album. You can easily reproduce this: 1. Send a PUT request to the album endpoint with the following payload {"ids":[<VALID_ASSET_ID_HERE>, <10_THOUSAND_RANDOM_UUIDS_HERE>]} 2. Add to album normally immediately after When Nº 1 finishes, reload the album, you should see now that only 1 or 2 assets appear in the album. The endpoint first loads the album with the assets, then processes the incoming IDs to then finally save the changes with the new album assets. If the album assets change because of another request during this period those changes will get overwritten. The easiest fix is to send a single request to the album with all asset IDs after uploading them all but if the upload stops midway for whatever reason no assets will get added.
Author
Owner

@ghost commented on GitHub (Sep 4, 2023):

Same issue, some assets are often missing from the album when uploading from the web. They are correctly uploaded (visible in the photos) but not added correctly to the album.

@ghost commented on GitHub (Sep 4, 2023): Same issue, some assets are often missing from the album when uploading from the web. They are correctly uploaded (visible in the photos) but not added correctly to the album.
Author
Owner

@jrasm91 commented on GitHub (Sep 5, 2023):

That's a good find. This endpoint isn't designed very well and needs to be reworked.

@jrasm91 commented on GitHub (Sep 5, 2023): That's a good find. This endpoint isn't designed very well and needs to be reworked.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#1087