immich icon indicating copy to clipboard operation
immich copied to clipboard

Review duplicates utility does not stack photos or save changes (v1.127.0)

Open reven opened this issue 1 year ago • 3 comments

The bug

Using the Duplicates utility does not save changes. After using "Stack" button, the images disappear and the next pair/group is loaded in. The process continues without any issues or error messages. Navigating away from the tool after one or various changes and then coming back to the tool, the exact same pairs/groups of images are listed for resolution and the total number of duplicates is the same as before any duplicates were resolved.

The OS that Immich Server is running on

Ubuntu 24.04.2

Version of Immich Server

v1.127.0

Version of Immich Mobile App

n/a

Platform with the issue

  • [x] Server
  • [x] Web
  • [ ] Mobile

Your docker-compose.yml content

#
# WARNING: Make sure to use the docker-compose.yml of the current release:
#
# https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
#
# The compose file on main may not be compatible with the latest release.
#

name: immich

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends:
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    volumes:
      # Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - '2283:2283'
    depends_on:
      - redis
      - database
    restart: always
    healthcheck:
      disable: false

  immich-machine-learning:
    container_name: immich_machine_learning
    # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag.
    # Example tag: ${IMMICH_VERSION:-release}-cuda
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration
    #   file: hwaccel.ml.yml
    #   service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: always
    healthcheck:
      disable: false

  redis:
    container_name: immich_redis
    image: docker.io/redis:6.2-alpine@sha256:eaba718fecd1196d88533de7ba49bf903ad33664a92debb24660a922ecd9cac8
    healthcheck:
      test: redis-cli ping || exit 1
    restart: always

  database:
    container_name: immich_postgres
    image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      POSTGRES_INITDB_ARGS: '--data-checksums'
    volumes:
      # Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
    healthcheck:
      test: >-
        pg_isready --dbname="$${POSTGRES_DB}" --username="$${POSTGRES_USER}" || exit 1;
        Chksum="$$(psql --dbname="$${POSTGRES_DB}" --username="$${POSTGRES_USER}" --tuples-only --no-align
        --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')";
        echo "checksum failure count is $$Chksum";
        [ "$$Chksum" = '0' ] || exit 1
      interval: 5m
      start_interval: 30s
      start_period: 5m
    command: >-
      postgres
      -c shared_preload_libraries=vectors.so
      -c 'search_path="$$user", public, vectors'
      -c logging_collector=on
      -c max_wal_size=2GB
      -c shared_buffers=512MB
      -c wal_compression=on
    restart: always

volumes:
  model-cache:

Your .env content

# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables

# The location where your uploaded files are stored
UPLOAD_LOCATION=/media/nibbler/Photo_Library
# The location where your database files are stored
DB_DATA_LOCATION=./postgres

# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
TZ=America/Los_Angeles

# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=release

# Connection secret for postgres. You should change it to a random password
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
DB_PASSWORD=XXXXXXXXXXXXXXXXXXXXXXX

# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

Reproduction steps

  1. Choose "Utilities" in the web menu
  2. Choose "Review Duplicates"
  3. Select "Stack" (In my case Immich is mostly detecting CR2 and JPG pairs). No error and Duplicates number at the top decreases.
  4. Repeat 3 any number of times
  5. Navigate away from tool, for example clicking on Photos
  6. Repeat steps 1 and 2
  7. The exact same images are offered for resolution as before steps 3 and 4, and the "Duplicates" number has not decreased. ...

Relevant log output

[Nest] 17  - 02/27/2025, 7:53:24 PM   DEBUG [Api:LoggingInterceptor~h79tdwwl] GET /api/search/explore 200 10.60ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:24 PM   DEBUG [Api:LoggingInterceptor~7d5q9s4b] GET /api/people?withHidden=false 200 114.54ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:28 PM   DEBUG [Api:LoggingInterceptor~iy98hgrm] GET /api/duplicates 200 29.30ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:28 PM   DEBUG [Api:LoggingInterceptor~pk12eing] GET /api/albums?assetId=ba97b0f4-78d1-4bbe-a831-72c23ad482f2 200 2.87ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:28 PM   DEBUG [Api:LoggingInterceptor~dljb5nhi] GET /api/albums?assetId=e35bc277-48a5-4126-a49c-e320533cd0d2 200 3.88ms ::ffff:192.168.1.5




[Nest] 17  - 02/27/2025, 7:53:37 PM   DEBUG [Api:LoggingInterceptor~83jw5jxd] GET /api/server/ping 200 0.10ms ::ffff:127.0.0.1
[Nest] 17  - 02/27/2025, 7:53:42 PM   DEBUG [Api:LoggingInterceptor~57zqmx4o] POST /api/stacks 201 17.77ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:42 PM   DEBUG [Api:LoggingInterceptor~pfm0rqgn] PUT /api/assets 204 0.91ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:43 PM   DEBUG [Api:LoggingInterceptor~4n8ujkdi] GET /api/albums?assetId=894ccdf0-e646-452e-9375-617701fcff5c 200 3.38ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:43 PM   DEBUG [Api:LoggingInterceptor~n9rxfnnb] GET /api/albums?assetId=62e3d860-232e-4cb9-b0f2-6a9275648114 200 2.79ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:47 PM   DEBUG [Api:LoggingInterceptor~7e2j1v9t] POST /api/stacks 201 31.88ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:47 PM   DEBUG [Api:LoggingInterceptor~nctx97or] PUT /api/assets 204 0.78ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:47 PM   DEBUG [Api:LoggingInterceptor~regbttnt] GET /api/albums?assetId=49d1780e-341f-438e-9966-bb6a30ba3e75 200 2.75ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:47 PM   DEBUG [Api:LoggingInterceptor~wdjxgh94] GET /api/albums?assetId=a3fb2851-4434-4b03-93f0-7668b1d5f9a6 200 3.47ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:48 PM   DEBUG [Api:LoggingInterceptor~bskq36rj] POST /api/stacks 201 21.56ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:49 PM   DEBUG [Api:LoggingInterceptor~jh33qe6q] PUT /api/assets 204 0.79ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:49 PM   DEBUG [Api:LoggingInterceptor~3s6c3qib] GET /api/albums?assetId=56ebea59-852a-4e68-9df3-b63e1cac8f76 200 3.60ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:49 PM   DEBUG [Api:LoggingInterceptor~far317w4] GET /api/albums?assetId=dad84f8a-43b4-4514-906c-5a301ec8feb7 200 4.47ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:50 PM   DEBUG [Api:LoggingInterceptor~mi6hcqeh] POST /api/stacks 201 29.08ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:50 PM   DEBUG [Api:LoggingInterceptor~rv72nqwv] PUT /api/assets 204 0.86ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:50 PM   DEBUG [Api:LoggingInterceptor~q43m3sj9] GET /api/albums?assetId=bec75871-8484-49e2-baf5-f1cf5dca37df 200 4.15ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:50 PM   DEBUG [Api:LoggingInterceptor~zy58orwa] GET /api/albums?assetId=1949760f-7015-4c8f-9a2c-433cfe42f6a5 200 3.70ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:51 PM   DEBUG [Api:LoggingInterceptor~bewuv4q4] POST /api/stacks 201 18.50ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:51 PM   DEBUG [Api:LoggingInterceptor~jf04klm9] PUT /api/assets 204 0.93ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:51 PM   DEBUG [Api:LoggingInterceptor~nladr2po] GET /api/albums?assetId=db8a6cf2-6030-4208-9d07-9e7499f48c0d 200 3.57ms ::ffff:192.168.1.5
[Nest] 17  - 02/27/2025, 7:53:51 PM   DEBUG [Api:LoggingInterceptor~rkh6wt6i] GET /api/albums?assetId=723a8270-4f74-4dde-98d6-7bea74e3da9a 200 4.74ms ::ffff:192.168.1.5

Additional information

No response

reven avatar Feb 28 '25 03:02 reven

This worked as expected in v 1.123.0. No other changes were done to server prior to update.

reven avatar Feb 28 '25 06:02 reven

I got same bug. Fresh install of 1.127.0 on ubuntu 22.04 with docker compose.

mergoodandroid avatar Feb 28 '25 17:02 mergoodandroid

same issue on 1.128.0 but with "keep all" not "stack" button

pilvepank avatar Mar 01 '25 08:03 pilvepank

Still an issue in v1.129.0. Keep all is not remembered.

Reproduce steps:

  • Go to Review Duplicates
  • Click on "Select keep all" and then "Keep all"
  • Refresh the page -> same duplicate showing up again

keesjebal avatar Mar 06 '25 01:03 keesjebal

I also have this issue with the latest 2-3 releases.

Here are some verbose logs:

...
[Nest] 18  - 03/09/2025, 9:39:55 PM   DEBUG [Api:LoggingInterceptor~h2jb0bja] GET /api/albums?assetId=fafce94e-33ec-4752-80e4-b77d65e5d25e 200 81.79ms 10.0.0.35
[Nest] 18  - 03/09/2025, 9:39:55 PM   DEBUG [Api:LoggingInterceptor~negpkhgt] GET /api/albums?assetId=12a47e3e-e221-4665-b3df-c274d30edab6 200 90.18ms 10.0.0.35

After selecting both images and choosing to keep them:

[Nest] 18  - 03/09/2025, 9:41:23 PM   DEBUG [Api:LoggingInterceptor~33h1625r] DELETE /api/assets 204 2.78ms 10.0.0.35
[Nest] 18  - 03/09/2025, 9:41:23 PM VERBOSE [Api:LoggingInterceptor~33h1625r] {"ids":[],"force":false}
[Nest] 18  - 03/09/2025, 9:41:23 PM   DEBUG [Api:LoggingInterceptor~4fh4fp3p] PUT /api/assets 204 4.25ms 10.0.0.35
[Nest] 18  - 03/09/2025, 9:41:23 PM VERBOSE [Api:LoggingInterceptor~4fh4fp3p] {"ids":["12a47e3e-e221-4665-b3df-c274d30edab6","fafce94e-33ec-4752-80e4-b77d65e5d25e"],"duplicateId":null}

After refreshing the page https://immich.somedomain/utilities/duplicates the same duplicates I choose to keep show up again:

[Nest] 18  - 03/09/2025, 9:42:38 PM   DEBUG [Api:LoggingInterceptor~161myg2x] GET /api/albums?assetId=12a47e3e-e221-4665-b3df-c274d30edab6 200 125.25ms 10.0.0.35
[Nest] 18  - 03/09/2025, 9:42:38 PM   DEBUG [Api:LoggingInterceptor~xe25pwu3] GET /api/albums?assetId=fafce94e-33ec-4752-80e4-b77d65e5d25e 200 121.98ms 10.0.0.35

Is my expectation wrong, that after I keep both images, that they won't get tagged as "duplicates", as long as I don't run the job again?

TuncTaylan avatar Mar 09 '25 20:03 TuncTaylan

Have the same issue on 1.129.0 For delete, stack and keep.

StoricU avatar Mar 12 '25 20:03 StoricU

Same issue... Ubuntu 24.04.2 / v1.127.0

jjjjoooonnnn avatar Mar 15 '25 20:03 jjjjoooonnnn

Just upgraded and still the same same in v1.129.0

jjjjoooonnnn avatar Mar 15 '25 20:03 jjjjoooonnnn

Also having this issue. New to using immich, so completely fresh install. Ubuntu 24.04.2 LTS immich v1.129.0

jackg9890 avatar Mar 16 '25 14:03 jackg9890

I've encountered this in 1.129 as well, running Ubuntu server 24.04 LTS. I've seen it for pictures both entirely in my library uploaded within the app, in external libraries, and pictures across both.

realjacoblinder avatar Mar 16 '25 14:03 realjacoblinder

And the release of v1.130.0 and v1.130.1 didn't fix this issue.

Edit: And with v1.130.2 no fix in sight.

Edit2: v1.131.3 is affected as well

TuncTaylan avatar Mar 25 '25 15:03 TuncTaylan

Issue still present in v1.130.3

jackg9890 avatar Mar 30 '25 18:03 jackg9890

Seeing similar behavior on a docker container running on a Synology, with a caveat.

Stack function - it memorizes. Keep all - it doesn't. If I navigate away from the tool and come back the same pictures will appear.

GitCharlieHub avatar Apr 04 '25 15:04 GitCharlieHub

Still happening in v1.31.3 ... the ones that i choose to "keep all" are still appearing everytime i load the page, this dificultes cleaning duplicates as each time i have to start with all the ones i want to keep until i get to new sets of groups to keep deleting.

agusdmb avatar Apr 08 '25 09:04 agusdmb

Same problem here 😢

fpaivinha avatar Apr 11 '25 21:04 fpaivinha

bug was probably introduced with this commit: https://github.com/immich-app/immich/commit/d12b1c907d68a9f9e6e4d459f6367c05f5872f03

TitanNano avatar Apr 11 '25 23:04 TitanNano

I first started seeing this bug already in one of the v1.125.x versions. Can't recall exactly which one but my guess would be that the issue is a regression from the move to Kysely

A few similar issues were posted since those releases which were referenced in the supposed fix PR #16380 but people are still reporting these same issues happening. From my own testing I can consistently select all images and choose keep all then reload the page and have them show up again.

ItsMestro avatar Apr 13 '25 19:04 ItsMestro

Hello! Just tried server v1.132.1 and the duplicate issue persists.

If I advance with keep all or stack and go out of the utility and then back in, it will show the same pictures.

GitCharlieHub avatar Apr 24 '25 17:04 GitCharlieHub

Wow, it's been many months and this issue stil persists. It blocks me to use the immich, since I can't possible clear duplicates, if the same photos gets shown...

Hey @mertalev , @alextran1502 , @jrasm91 , @danieldietzler , could you please take a look at here?

TuncTaylan avatar May 01 '25 16:05 TuncTaylan

@TuncTaylan I understand that this issue is annoying for you. If you look through all the issues though you'll notice that there are in fact many issues that are open for multiple months. :) There's no need to ping the core team about this, and it won't change anything in when we get to it. Feel free to open a pull request to fix it though!

danieldietzler avatar May 01 '25 20:05 danieldietzler

Believe me, @danieldietzler, I would have already if I could. I just don't have much experience with modern frontend frameworks.

Also, I don’t want to get into discussions about how long issues stay open, the project's funding, or anything along those lines. That’s not the point here.

The fact is, this particular issue blocks users from using a major feature “clearing duplicates.” You can imagine how frustrating and discouraging it is for new users when they realize they can’t remove duplicates without manually reviewing every single photo they’ve already carefully selected.

It’s just a major blocker to using your product, and I’m signaling this to you, nothing more. I find it unfortunate that the first response is essentially: it’s open source, fix it yourself and send a PR. That’s really not a constructive way to handle a critical usability issue.

Schönen Brückentag noch ;)

TuncTaylan avatar May 02 '25 07:05 TuncTaylan

Hey @TuncTaylan, I do understand that this is a critical issue for you and possibly many users. So are many issues here though. Most users have their "most important issue/pain point" and the truth is we cannot fix them all at the same time.

danieldietzler avatar May 02 '25 09:05 danieldietzler

It looks like resolving all duplicates as "keep" should result into deleting duplicateId (sending explicit null from the client side). But the update service doesn't see any change if the fields in question are null hence skipping the update all together effectively keeping previous duplicateIds.

I am not sure how to properly fix it though since I am not familiar with the code base. But it either a different factor to indicate deletion from the client side or a strict comparisson with undefined (so null is considered as explicit deletion).

I have tried changing the line to duplicateId !== undefined on my server instance and can confirm that it fixed the bug. For those of you who would like this quick and dirty solution: attach to your immich-server docker container, modify /usr/src/app/dist/services/asset.service.js (see the exact place in the screenshots bellow) by replacing duplicateId != undefined with duplicateId !== undefined.

Image Image

zzzorgo avatar May 04 '25 08:05 zzzorgo

Unfortunately it didn't work. Image

TuncTaylan avatar May 04 '25 09:05 TuncTaylan

@zzzorgo confirm I did the same as you and it works! Many thanks for the quick debug!

Also not skilled enough to understand the code base and check 100% this is the fix needed but hope @danieldietzler can check if this fixes the issue and can be pushed in next version.

It looks like resolving all duplicates as "keep" should result into deleting duplicateId (sending explicit null from the client side). But the update service doesn't see any change if the fields in question are null hence skipping the update all together effectively keeping previous duplicateIds.

I am not sure how to properly fix it though since I am not familiar with the code base. But it either a different factor to indicate deletion from the client side or a strict comparisson with undefined (so null is considered as explicit deletion).

I have tried changing the line to duplicateId !== undefined on my server instance and can confirm that it fixed the bug. For those of you who would like this quick and dirty solution: attach to your immich-server docker container, modify /usr/src/app/dist/services/asset.service.js (see the exact place in the screenshots bellow) by replacing duplicateId != undefined with duplicateId !== undefined.

Image Image

GitCharlieHub avatar May 04 '25 11:05 GitCharlieHub

I can also confirm that this works. I converted @zzzorgo's instructions into a PR for easy application. IDK if this is the full solution but at least serves as a starting point and can easily be patched into your Immich if desired. I am now running this patch on my Immich and it is working.

https://github.com/immich-app/immich/pull/18070

kevincox avatar May 04 '25 11:05 kevincox

Unfortunately it didn't work. Image

Sorry, I forgot to tell that you also need to restart the container after the change is made. And also - the fix will evaporate after pulling the new docker image version, so it is really a temporary workaround :)

zzzorgo avatar May 04 '25 12:05 zzzorgo

Indeed, thanks, can also confirm.

TuncTaylan avatar May 04 '25 12:05 TuncTaylan