Mobile asset blacklist cannot be resolved violation UQ_assets_owner_checksum #6465

Closed
opened 2026-02-05 12:18:23 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @ronzino83 on GitHub (Jul 16, 2025).

I have searched the existing issues, both open and closed, to make sure this is not a duplicate report.

  • Yes

The bug

When on mobile, the app is deleted/reinstalled (e.g. app cache and data clear, new smartphone, i.e. Smartphone Immich DB is lost) there is no way to realign server and mobile databases if storage template is enabled AND asset is moved before mobile DB drop: smartphone blacklists assets even if they reflect exactly the ones on server (same folders, same albums, same pictures).

Other users (https://github.com/immich-app/immich/issues/15051) have run into the bug UQ_assets_owner_checksum after smartphone DB drop or assets movements back and forward, but reproduction steps are not given: mine follows, I hope now it will be possible to fix this

The OS that Immich Server is running on

Ubuntu 25.04

Version of Immich Server

v1.135.3

Version of Immich Mobile App

v1.135.1.build.202 Android playstore

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

not relevant

Your .env content

not relevant

Reproduction steps

1.On Immich Server, enable Storage template {{album}}
2.On smartphone gallery create "Album1" and add asset "A" and "B"
3.On smartphone gallery create "Album2" and add asset "C" and "D"
4.On smartphone open Immich, add smartphone "Album1" and "Album2" to backup Assets and Sync
5.On server, folder "Album1", "Album2" are created
6.On server, album "Album1", "Album2" are created

7.On server, assets "A", "B", "C", "D" are uploaded and move in the right folders and albums.
8.On smartphone gallery, move asset "B" from "Album1" to "Album2"
9.On smartphone open Immich app and Sync
10.On server, invoke "storage template migration" in order to reflect asset folder change
11. On server, asset "B" is moved (stored) in "Album2" folder
12. On server, asset "B" is listed both in "Album1" and "Album2" albums

up to this everything works as expected. Now, lets trigger the bug.

13.On smartphone clear cache and data of Immich app
14.On smarphone open Immich, and configure again "Album1" and "Album2" to backup Assets (please note that smartphone galleris content was keep untouched respect step 8. . So "Album1" contains only asset "A" while "Album2" contains "B", "C", "D".
15. Sync smartphone
16. On server, notthing will change: folders albums assets are fine and not modified by smarpthone sync.
17. _On smartphone, 1 element is warned as Duplicate blacklisted. Smartphone does not tell you that it is asset "B" . **This Duplicate blacklisted asset cannot be resolved or fixed and please note that it is a false positive as smartphone folder album asset are exactly the same on server ** _
18. Clear duplicates on smartphone, and Sync trigger server LOG ERRORS
19. storge templeate migration on server, check duplicates on server, does not solve the blacklisting on smartphone.
20. Moving back on smartphone asset "B" to gallery "Album1" does not solve the problem
21. On server, removing asset "A" from "Album1" does not solve the problem

In the following logs, i have 5 assets affected

  • 20250714_143859.jpg
  • IMG_20191218_233456.jpg
  • IMG_20231129_222804.jpg
  • IMG_20231129_222802.jpg
  • IMG_20231118_192102.jpg

PLEASE NOTE:
The asset "B" move from "Album1" to "Album2" is a bug precondition: if you don't move it, and do all the other steps, the bug is not triggered.

Relevant log output

SERVER LOG at point number 18
2025-07-15 23:10:00.073081+00:00Query failed : {
2025-07-15 23:10:00.073111+00:00durationMs: 1.6447380000026897,
2025-07-15 23:10:00.073119+00:00error: PostgresError: duplicate key value violates unique constraint "UQ_assets_owner_checksum"
2025-07-15 23:10:00.073126+00:00at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:790:26)
2025-07-15 23:10:00.073131+00:00at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:476:6)
2025-07-15 23:10:00.073137+00:00at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9)
2025-07-15 23:10:00.073144+00:00at Socket.emit (node:events:518:28)
2025-07-15 23:10:00.073149+00:00at addChunk (node:internal/streams/readable:561:12)
2025-07-15 23:10:00.073155+00:00at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
2025-07-15 23:10:00.073161+00:00at Readable.push (node:internal/streams/readable:392:5)
2025-07-15 23:10:00.073167+00:00at TCP.onStreamRead (node:internal/stream_base_commons:189:23)
2025-07-15 23:10:00.073173+00:00at TCP.callbackTrampoline (node:internal/async_hooks:130:17) {
2025-07-15 23:10:00.073179+00:00severity_local: 'ERROR',
2025-07-15 23:10:00.073189+00:00severity: 'ERROR',
2025-07-15 23:10:00.073195+00:00code: '23505',
2025-07-15 23:10:00.073202+00:00detail: 'Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \\x38aed7effed593e857753685e5f6a0c2092b2ebd) already exists.',
2025-07-15 23:10:00.073208+00:00schema_name: 'public',
2025-07-15 23:10:00.073215+00:00table_name: 'assets',
2025-07-15 23:10:00.073221+00:00constraint_name: 'UQ_assets_owner_checksum',
2025-07-15 23:10:00.073255+00:00file: 'nbtinsert.c',
2025-07-15 23:10:00.073286+00:00line: '664',
2025-07-15 23:10:00.073332+00:00routine: '_bt_check_unique'
2025-07-15 23:10:00.073342+00:00},
2025-07-15 23:10:00.073349+00:00sql: 'insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *',
2025-07-15 23:10:00.073358+00:00params: [
2025-07-15 23:10:00.073365+00:00'e1dcc5af-7ed6-452e-a703-71426f3503f2',
2025-07-15 23:10:00.073372+00:00null,
2025-07-15 23:10:00.073378+00:00<Buffer 38 ae d7 ef fe d5 93 e8 57 75 36 85 e5 f6 a0 c2 09 2b 2e bd>,
2025-07-15 23:10:00.073384+00:00'upload/upload/e1dcc5af-7ed6-452e-a703-71426f3503f2/83/82/83822a1d-ecdf-4e0b-a8ec-1c870e98e15a.jpg',
2025-07-15 23:10:00.073406+00:00'1000091368',
2025-07-15 23:10:00.073418+00:00'9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a',
2025-07-15 23:10:00.073425+00:002025-07-14T12:39:00.000Z,
2025-07-15 23:10:00.073432+00:002025-07-14T12:39:02.000Z,
2025-07-15 23:10:00.073438+00:002025-07-14T12:39:00.000Z,
2025-07-15 23:10:00.073444+00:00'IMAGE',
2025-07-15 23:10:00.073451+00:00false,
2025-07-15 23:10:00.073457+00:00'0:00:00.000000',
2025-07-15 23:10:00.073464+00:00'timeline',
2025-07-15 23:10:00.073470+00:00'20250714_143859.jpg'
2025-07-15 23:10:00.073476+00:00]
2025-07-15 23:10:00.073484+00:00}
2025-07-15 23:10:00.075363+00:00[Nest] 24  - 07/16/2025, 1:10:00 AM   DEBUG [Api:LoggingInterceptor~cosylh9k] POST /api/assets 200 250.76ms ::ffff:192.168.119.36
2025-07-15 23:10:00.075415+00:00[Nest] 24  - 07/16/2025, 1:10:00 AM VERBOSE [Api:LoggingInterceptor~cosylh9k] {"deviceAssetId":"1000091368","deviceId":"9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a","fileCreatedAt":"2025-07-14T12:39:00.000Z","fileModifiedAt":"2025-07-14T12:39:02.000Z","isFavorite":"false","duration":"0:00:00.000000"}
2025-07-15 23:10:00.088932+00:00[Nest] 24  - 07/16/2025, 1:10:00 AM   DEBUG [Api:LoggingInterceptor~09v7ykv4] GET /api/server/storage 200 0.30ms ::ffff:192.168.119.36
2025-07-15 23:10:00.113211+00:00[Nest] 24  - 07/16/2025, 1:10:00 AM   DEBUG [Api:LoggingInterceptor~p0dut6yw] PUT /api/albums/0d99f1ed-b00c-41c3-a4f8-b8eafdf1b0f6/assets 200 3.51ms ::ffff:192.168.119.36
2025-07-15 23:10:00.113267+00:00[Nest] 24  - 07/16/2025, 1:10:00 AM VERBOSE [Api:LoggingInterceptor~p0dut6yw] {"ids":["8661d6c6-1369-4ef9-ab63-789949ba5892"]}
2025-07-15 23:10:00.444832+00:00Query failed : {
2025-07-15 23:10:00.444871+00:00durationMs: 1.821866000071168,
2025-07-15 23:10:00.444881+00:00error: PostgresError: duplicate key value violates unique constraint "UQ_assets_owner_checksum"
2025-07-15 23:10:00.444888+00:00at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:790:26)
2025-07-15 23:10:00.444895+00:00at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:476:6)
2025-07-15 23:10:00.444902+00:00at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9)
2025-07-15 23:10:00.444908+00:00at Socket.emit (node:events:518:28)
2025-07-15 23:10:00.444914+00:00at addChunk (node:internal/streams/readable:561:12)
2025-07-15 23:10:00.444920+00:00at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
2025-07-15 23:10:00.444927+00:00at Readable.push (node:internal/streams/readable:392:5)
2025-07-15 23:10:00.444933+00:00at TCP.onStreamRead (node:internal/stream_base_commons:189:23)
2025-07-15 23:10:00.444939+00:00at TCP.callbackTrampoline (node:internal/async_hooks:130:17) {
2025-07-15 23:10:00.444945+00:00severity_local: 'ERROR',
2025-07-15 23:10:00.444951+00:00severity: 'ERROR',
2025-07-15 23:10:00.444957+00:00code: '23505',
2025-07-15 23:10:00.444964+00:00detail: 'Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \\xf24158fd589c1c4ab04772e922fad59f0fd07584) already exists.',
2025-07-15 23:10:00.444972+00:00schema_name: 'public',
2025-07-15 23:10:00.444982+00:00table_name: 'assets',
2025-07-15 23:10:00.444988+00:00constraint_name: 'UQ_assets_owner_checksum',
2025-07-15 23:10:00.444995+00:00file: 'nbtinsert.c',
2025-07-15 23:10:00.445001+00:00line: '664',
2025-07-15 23:10:00.445007+00:00routine: '_bt_check_unique'
2025-07-15 23:10:00.445013+00:00},
2025-07-15 23:10:00.445019+00:00sql: 'insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *',
2025-07-15 23:10:00.445049+00:00params: [
2025-07-15 23:10:00.445057+00:00'e1dcc5af-7ed6-452e-a703-71426f3503f2',
2025-07-15 23:10:00.445064+00:00null,
2025-07-15 23:10:00.445071+00:00<Buffer f2 41 58 fd 58 9c 1c 4a b0 47 72 e9 22 fa d5 9f 0f d0 75 84>,
2025-07-15 23:10:00.445078+00:00'upload/upload/e1dcc5af-7ed6-452e-a703-71426f3503f2/77/8d/778d094b-d549-4e76-9122-cdc2606180c2.jpg',
2025-07-15 23:10:00.445084+00:00'1000090605',
2025-07-15 23:10:00.445090+00:00'9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a',
2025-07-15 23:10:00.445097+00:002019-12-19T02:34:56.000Z,
2025-07-15 23:10:00.445104+00:002024-02-03T00:03:51.000Z,
2025-07-15 23:10:00.445110+00:002019-12-19T02:34:56.000Z,
2025-07-15 23:10:00.445116+00:00'IMAGE',
2025-07-15 23:10:00.445122+00:00false,
2025-07-15 23:10:00.445128+00:00'0:00:00.000000',
2025-07-15 23:10:00.445135+00:00'timeline',
2025-07-15 23:10:00.445141+00:00'IMG_20191218_233456.jpg'
2025-07-15 23:10:00.445148+00:00]
2025-07-15 23:10:00.445154+00:00}
2025-07-15 23:10:00.446932+00:00[Nest] 24  - 07/16/2025, 1:10:00 AM   DEBUG [Api:LoggingInterceptor~wjvdvb28] POST /api/assets 200 285.40ms ::ffff:192.168.119.36
2025-07-15 23:10:00.447012+00:00[Nest] 24  - 07/16/2025, 1:10:00 AM VERBOSE [Api:LoggingInterceptor~wjvdvb28] {"deviceAssetId":"1000090605","deviceId":"9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a","fileCreatedAt":"2019-12-19T02:34:56.000Z","fileModifiedAt":"2024-02-03T00:03:51.000Z","isFavorite":"false","duration":"0:00:00.000000"}
2025-07-15 23:10:00.461303+00:00[Nest] 24  - 07/16/2025, 1:10:00 AM   DEBUG [Api:LoggingInterceptor~whrbbg5k] GET /api/server/storage 200 0.64ms ::ffff:192.168.119.36
2025-07-15 23:10:00.466340+00:00[Nest] 24  - 07/16/2025, 1:10:00 AM   DEBUG [Api:LoggingInterceptor~4l33io98] PUT /api/albums/0d99f1ed-b00c-41c3-a4f8-b8eafdf1b0f6/assets 200 2.80ms ::ffff:192.168.119.36
2025-07-15 23:10:00.466391+00:00[Nest] 24  - 07/16/2025, 1:10:00 AM VERBOSE [Api:LoggingInterceptor~4l33io98] {"ids":["eecaaf83-b4a9-4010-88cc-ad2919a77de9"]}
2025-07-15 23:10:00.942952+00:00Query failed : {
2025-07-15 23:10:00.942995+00:00durationMs: 1.696460000006482,
2025-07-15 23:10:00.943006+00:00error: PostgresError: duplicate key value violates unique constraint "UQ_assets_owner_checksum"
2025-07-15 23:10:00.943014+00:00at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:790:26)
2025-07-15 23:10:00.943021+00:00at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:476:6)
2025-07-15 23:10:00.943028+00:00at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9)
2025-07-15 23:10:00.943035+00:00at Socket.emit (node:events:518:28)
2025-07-15 23:10:00.943046+00:00at addChunk (node:internal/streams/readable:561:12)
2025-07-15 23:10:00.943053+00:00at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
2025-07-15 23:10:00.943059+00:00at Readable.push (node:internal/streams/readable:392:5)
2025-07-15 23:10:00.943066+00:00at TCP.onStreamRead (node:internal/stream_base_commons:189:23)
2025-07-15 23:10:00.943073+00:00at TCP.callbackTrampoline (node:internal/async_hooks:130:17) {
2025-07-15 23:10:00.943079+00:00severity_local: 'ERROR',
2025-07-15 23:10:00.943086+00:00severity: 'ERROR',
2025-07-15 23:10:00.943093+00:00code: '23505',
2025-07-15 23:10:00.943101+00:00detail: 'Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \\x72e15a76036c1cb7ff119784fe8c9bb67282b8ca) already exists.',
2025-07-15 23:10:00.943108+00:00schema_name: 'public',
2025-07-15 23:10:00.943114+00:00table_name: 'assets',
2025-07-15 23:10:00.943121+00:00constraint_name: 'UQ_assets_owner_checksum',
2025-07-15 23:10:00.943128+00:00file: 'nbtinsert.c',
2025-07-15 23:10:00.943135+00:00line: '664',
2025-07-15 23:10:00.943141+00:00routine: '_bt_check_unique'
2025-07-15 23:10:00.943148+00:00},
2025-07-15 23:10:00.943156+00:00sql: 'insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *',
2025-07-15 23:10:00.943165+00:00params: [
2025-07-15 23:10:00.943171+00:00'e1dcc5af-7ed6-452e-a703-71426f3503f2',
2025-07-15 23:10:00.943178+00:00null,
2025-07-15 23:10:00.943185+00:00<Buffer 72 e1 5a 76 03 6c 1c b7 ff 11 97 84 fe 8c 9b b6 72 82 b8 ca>,
2025-07-15 23:10:00.943193+00:00'upload/upload/e1dcc5af-7ed6-452e-a703-71426f3503f2/1c/6f/1c6ff236-c773-4d21-aba3-3a3354eb2a0d.jpg',
2025-07-15 23:10:00.943200+00:00'1000090604',
2025-07-15 23:10:00.943207+00:00'9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a',
2025-07-15 23:10:00.943214+00:002023-11-29T21:28:06.000Z,
2025-07-15 23:10:00.943221+00:002024-02-03T00:01:41.000Z,
2025-07-15 23:10:00.943228+00:002023-11-29T21:28:06.000Z,
2025-07-15 23:10:00.943234+00:00'IMAGE',
2025-07-15 23:10:00.943242+00:00false,
2025-07-15 23:10:00.943249+00:00'0:00:00.000000',
2025-07-15 23:10:00.943256+00:00'timeline',
2025-07-15 23:10:00.943264+00:00'IMG_20231129_222804.jpg'
2025-07-15 23:10:00.943272+00:00]
2025-07-15 23:10:00.943279+00:00}
2025-07-15 23:10:00.946266+00:00[Nest] 24  - 07/16/2025, 1:10:00 AM   DEBUG [Api:LoggingInterceptor~524l0eg8] POST /api/assets 200 433.49ms ::ffff:192.168.119.36
2025-07-15 23:10:00.946343+00:00[Nest] 24  - 07/16/2025, 1:10:00 AM VERBOSE [Api:LoggingInterceptor~524l0eg8] {"deviceAssetId":"1000090604","deviceId":"9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a","fileCreatedAt":"2023-11-29T21:28:06.000Z","fileModifiedAt":"2024-02-03T00:01:41.000Z","isFavorite":"false","duration":"0:00:00.000000"}
2025-07-15 23:10:00.959643+00:00[Nest] 24  - 07/16/2025, 1:10:00 AM   DEBUG [Api:LoggingInterceptor~wy3u5wb4] GET /api/server/storage 200 1.36ms ::ffff:192.168.119.36
2025-07-15 23:10:00.964299+00:00[Nest] 24  - 07/16/2025, 1:10:00 AM   DEBUG [Api:LoggingInterceptor~it9q7c0n] PUT /api/albums/0d99f1ed-b00c-41c3-a4f8-b8eafdf1b0f6/assets 200 3.18ms ::ffff:192.168.119.36
2025-07-15 23:10:00.964368+00:00[Nest] 24  - 07/16/2025, 1:10:00 AM VERBOSE [Api:LoggingInterceptor~it9q7c0n] {"ids":["8adc5cd3-5dd2-4bc3-aace-444fedcedbbd"]}
2025-07-15 23:10:01.370354+00:00Query failed : {
2025-07-15 23:10:01.370398+00:00durationMs: 1.4982359999557957,
2025-07-15 23:10:01.370409+00:00error: PostgresError: duplicate key value violates unique constraint "UQ_assets_owner_checksum"
2025-07-15 23:10:01.370417+00:00at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:790:26)
2025-07-15 23:10:01.370425+00:00at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:476:6)
2025-07-15 23:10:01.370432+00:00at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9)
2025-07-15 23:10:01.370439+00:00at Socket.emit (node:events:518:28)
2025-07-15 23:10:01.370446+00:00at addChunk (node:internal/streams/readable:561:12)
2025-07-15 23:10:01.370453+00:00at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
2025-07-15 23:10:01.370460+00:00at Readable.push (node:internal/streams/readable:392:5)
2025-07-15 23:10:01.370467+00:00at TCP.onStreamRead (node:internal/stream_base_commons:189:23)
2025-07-15 23:10:01.370474+00:00at TCP.callbackTrampoline (node:internal/async_hooks:130:17) {
2025-07-15 23:10:01.370480+00:00severity_local: 'ERROR',
2025-07-15 23:10:01.370492+00:00severity: 'ERROR',
2025-07-15 23:10:01.370499+00:00code: '23505',
2025-07-15 23:10:01.370506+00:00detail: 'Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \\xce18be7c42a71088f4fd4eee10fc1c14367df28d) already exists.',
2025-07-15 23:10:01.370513+00:00schema_name: 'public',
2025-07-15 23:10:01.370520+00:00table_name: 'assets',
2025-07-15 23:10:01.370527+00:00constraint_name: 'UQ_assets_owner_checksum',
2025-07-15 23:10:01.370534+00:00file: 'nbtinsert.c',
2025-07-15 23:10:01.370541+00:00line: '664',
2025-07-15 23:10:01.370551+00:00routine: '_bt_check_unique'
2025-07-15 23:10:01.370557+00:00},
2025-07-15 23:10:01.370565+00:00sql: 'insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *',
2025-07-15 23:10:01.370573+00:00params: [
2025-07-15 23:10:01.370580+00:00'e1dcc5af-7ed6-452e-a703-71426f3503f2',
2025-07-15 23:10:01.370587+00:00null,
2025-07-15 23:10:01.370595+00:00<Buffer ce 18 be 7c 42 a7 10 88 f4 fd 4e ee 10 fc 1c 14 36 7d f2 8d>,
2025-07-15 23:10:01.370603+00:00'upload/upload/e1dcc5af-7ed6-452e-a703-71426f3503f2/88/ca/88ca8531-1e07-458d-aff5-0021a500156f.jpg',
2025-07-15 23:10:01.370611+00:00'1000090602',
2025-07-15 23:10:01.370621+00:00'9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a',
2025-07-15 23:10:01.370629+00:002023-11-29T21:28:04.000Z,
2025-07-15 23:10:01.370636+00:002024-02-03T00:01:40.000Z,
2025-07-15 23:10:01.370643+00:002023-11-29T21:28:04.000Z,
2025-07-15 23:10:01.370650+00:00'IMAGE',
2025-07-15 23:10:01.370657+00:00false,
2025-07-15 23:10:01.370664+00:00'0:00:00.000000',
2025-07-15 23:10:01.370671+00:00'timeline',
2025-07-15 23:10:01.370678+00:00'IMG_20231129_222802.jpg'
2025-07-15 23:10:01.370685+00:00]
2025-07-15 23:10:01.370692+00:00}
2025-07-15 23:10:01.373271+00:00[Nest] 24  - 07/16/2025, 1:10:01 AM   DEBUG [Api:LoggingInterceptor~qe8ve2da] POST /api/assets 200 369.99ms ::ffff:192.168.119.36
2025-07-15 23:10:01.373354+00:00[Nest] 24  - 07/16/2025, 1:10:01 AM VERBOSE [Api:LoggingInterceptor~qe8ve2da] {"deviceAssetId":"1000090602","deviceId":"9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a","fileCreatedAt":"2023-11-29T21:28:04.000Z","fileModifiedAt":"2024-02-03T00:01:40.000Z","isFavorite":"false","duration":"0:00:00.000000"}
2025-07-15 23:10:01.385632+00:00[Nest] 24  - 07/16/2025, 1:10:01 AM   DEBUG [Api:LoggingInterceptor~m0vocnhw] GET /api/server/storage 200 0.45ms ::ffff:192.168.119.36
2025-07-15 23:10:01.391802+00:00[Nest] 24  - 07/16/2025, 1:10:01 AM   DEBUG [Api:LoggingInterceptor~uoagu5fe] PUT /api/albums/0d99f1ed-b00c-41c3-a4f8-b8eafdf1b0f6/assets 200 3.56ms ::ffff:192.168.119.36
2025-07-15 23:10:01.391862+00:00[Nest] 24  - 07/16/2025, 1:10:01 AM VERBOSE [Api:LoggingInterceptor~uoagu5fe] {"ids":["5792d195-0c26-4f09-a312-6a7e34343cc8"]}
2025-07-15 23:10:01.757427+00:00Query failed : {
2025-07-15 23:10:01.757491+00:00durationMs: 14.300225000013597,
2025-07-15 23:10:01.757501+00:00error: PostgresError: duplicate key value violates unique constraint "UQ_assets_owner_checksum"
2025-07-15 23:10:01.757510+00:00at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:790:26)
2025-07-15 23:10:01.757518+00:00at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:476:6)
2025-07-15 23:10:01.757525+00:00at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9)
2025-07-15 23:10:01.757532+00:00at Socket.emit (node:events:518:28)
2025-07-15 23:10:01.757539+00:00at addChunk (node:internal/streams/readable:561:12)
2025-07-15 23:10:01.757546+00:00at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
2025-07-15 23:10:01.757553+00:00at Readable.push (node:internal/streams/readable:392:5)
2025-07-15 23:10:01.757560+00:00at TCP.onStreamRead (node:internal/stream_base_commons:189:23)
2025-07-15 23:10:01.757567+00:00at TCP.callbackTrampoline (node:internal/async_hooks:130:17) {
2025-07-15 23:10:01.757574+00:00severity_local: 'ERROR',
2025-07-15 23:10:01.757581+00:00severity: 'ERROR',
2025-07-15 23:10:01.757587+00:00code: '23505',
2025-07-15 23:10:01.757594+00:00detail: 'Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \\x6a928dfc01ac40b82b9ff2dd0a10219f3f030a3f) already exists.',
2025-07-15 23:10:01.757601+00:00schema_name: 'public',
2025-07-15 23:10:01.757608+00:00table_name: 'assets',
2025-07-15 23:10:01.757615+00:00constraint_name: 'UQ_assets_owner_checksum',
2025-07-15 23:10:01.757623+00:00file: 'nbtinsert.c',
2025-07-15 23:10:01.757630+00:00line: '664',
2025-07-15 23:10:01.757637+00:00routine: '_bt_check_unique'
2025-07-15 23:10:01.757648+00:00},
2025-07-15 23:10:01.757656+00:00sql: 'insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *',
2025-07-15 23:10:01.757665+00:00params: [
2025-07-15 23:10:01.757672+00:00'e1dcc5af-7ed6-452e-a703-71426f3503f2',
2025-07-15 23:10:01.757678+00:00null,
2025-07-15 23:10:01.757685+00:00<Buffer 6a 92 8d fc 01 ac 40 b8 2b 9f f2 dd 0a 10 21 9f 3f 03 0a 3f>,
2025-07-15 23:10:01.757692+00:00'upload/upload/e1dcc5af-7ed6-452e-a703-71426f3503f2/85/5b/855bdb22-3871-4ca9-824f-0d14d2e2867e.jpg',
2025-07-15 23:10:01.757699+00:00'1000016458',
2025-07-15 23:10:01.757706+00:00'9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a',
2025-07-15 23:10:01.757713+00:002023-11-18T18:21:04.000Z,
2025-07-15 23:10:01.757720+00:002024-02-03T00:01:36.000Z,
2025-07-15 23:10:01.757726+00:002023-11-18T18:21:04.000Z,
2025-07-15 23:10:01.757733+00:00'IMAGE',
2025-07-15 23:10:01.757740+00:00false,
2025-07-15 23:10:01.757747+00:00'0:00:00.000000',
2025-07-15 23:10:01.757754+00:00'timeline',
2025-07-15 23:10:01.757761+00:00'IMG_20231118_192102.jpg'
2025-07-15 23:10:01.757768+00:00]
2025-07-15 23:10:01.757775+00:00}

--------------------------------------------

SMARPTHONE LOG at point number 18

does not contains relevant information about duplicate blacklisting
__________________________________________

POSTGRES LOG

2025-07-15 23:03:03.428202+00:002025-07-16 01:03:03.427 CEST [39] ERROR:  duplicate key value violates unique constraint "UQ_assets_owner_checksum"
2025-07-15 23:03:03.428245+00:002025-07-16 01:03:03.427 CEST [39] DETAIL:  Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \x38aed7effed593e857753685e5f6a0c2092b2ebd) already exists.
2025-07-15 23:03:03.428266+00:002025-07-16 01:03:03.427 CEST [39] STATEMENT:  insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *
2025-07-15 23:03:03.912889+00:002025-07-16 01:03:03.912 CEST [38] ERROR:  duplicate key value violates unique constraint "UQ_assets_owner_checksum"
2025-07-15 23:03:03.912924+00:002025-07-16 01:03:03.912 CEST [38] DETAIL:  Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \xf24158fd589c1c4ab04772e922fad59f0fd07584) already exists.
2025-07-15 23:03:03.912944+00:002025-07-16 01:03:03.912 CEST [38] STATEMENT:  insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *
2025-07-15 23:03:04.357671+00:002025-07-16 01:03:04.357 CEST [40] ERROR:  duplicate key value violates unique constraint "UQ_assets_owner_checksum"
2025-07-15 23:03:04.357714+00:002025-07-16 01:03:04.357 CEST [40] DETAIL:  Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \x72e15a76036c1cb7ff119784fe8c9bb67282b8ca) already exists.
2025-07-15 23:03:04.357723+00:002025-07-16 01:03:04.357 CEST [40] STATEMENT:  insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *
2025-07-15 23:03:04.766748+00:002025-07-16 01:03:04.766 CEST [39] ERROR:  duplicate key value violates unique constraint "UQ_assets_owner_checksum"
2025-07-15 23:03:04.766774+00:002025-07-16 01:03:04.766 CEST [39] DETAIL:  Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \xce18be7c42a71088f4fd4eee10fc1c14367df28d) already exists.
2025-07-15 23:03:04.766794+00:002025-07-16 01:03:04.766 CEST [39] STATEMENT:  insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *
2025-07-15 23:03:05.356720+00:002025-07-16 01:03:05.356 CEST [38] ERROR:  duplicate key value violates unique constraint "UQ_assets_owner_checksum"
2025-07-15 23:03:05.356773+00:002025-07-16 01:03:05.356 CEST [38] DETAIL:  Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \x6a928dfc01ac40b82b9ff2dd0a10219f3f030a3f) already exists.
2025-07-15 23:03:05.356798+00:002025-07-16 01:03:05.356 CEST [38] STATEMENT:  insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *
2025-07-15 23:07:30.793459+00:002025-07-16 01:07:30.793 CEST [18] LOG:  checkpoint starting: time
2025-07-15 23:07:32.612034+00:002025-07-16 01:07:32.611 CEST [18] LOG:  checkpoint complete: wrote 19 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.806 s, sync=0.009 s, total=1.819 s; sync files=9, longest=0.002 s, average=0.001 s; distance=49 kB, estimate=49 kB
2025-07-15 23:10:00.072624+00:002025-07-16 01:10:00.072 CEST [40] ERROR:  duplicate key value violates unique constraint "UQ_assets_owner_checksum"
2025-07-15 23:10:00.072679+00:002025-07-16 01:10:00.072 CEST [40] DETAIL:  Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \x38aed7effed593e857753685e5f6a0c2092b2ebd) already exists.
2025-07-15 23:10:00.072687+00:002025-07-16 01:10:00.072 CEST [40] STATEMENT:  insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *
2025-07-15 23:10:00.444172+00:002025-07-16 01:10:00.443 CEST [39] ERROR:  duplicate key value violates unique constraint "UQ_assets_owner_checksum"
2025-07-15 23:10:00.444216+00:002025-07-16 01:10:00.443 CEST [39] DETAIL:  Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \xf24158fd589c1c4ab04772e922fad59f0fd07584) already exists.
2025-07-15 23:10:00.444223+00:002025-07-16 01:10:00.443 CEST [39] STATEMENT:  insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *
2025-07-15 23:10:00.942376+00:002025-07-16 01:10:00.942 CEST [38] ERROR:  duplicate key value violates unique constraint "UQ_assets_owner_checksum"
2025-07-15 23:10:00.942412+00:002025-07-16 01:10:00.942 CEST [38] DETAIL:  Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \x72e15a76036c1cb7ff119784fe8c9bb67282b8ca) already exists.
2025-07-15 23:10:00.942441+00:002025-07-16 01:10:00.942 CEST [38] STATEMENT:  insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *
2025-07-15 23:10:01.369391+00:002025-07-16 01:10:01.369 CEST [40] ERROR:  duplicate key value violates unique constraint "UQ_assets_owner_checksum"
2025-07-15 23:10:01.369427+00:002025-07-16 01:10:01.369 CEST [40] DETAIL:  Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \xce18be7c42a71088f4fd4eee10fc1c14367df28d) already exists.
2025-07-15 23:10:01.369435+00:002025-07-16 01:10:01.369 CEST [40] STATEMENT:  insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *
2025-07-15 23:10:01.753602+00:002025-07-16 01:10:01.753 CEST [39] ERROR:  duplicate key value violates unique constraint "UQ_assets_owner_checksum"
2025-07-15 23:10:01.753664+00:002025-07-16 01:10:01.753 CEST [39] DETAIL:  Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \x6a928dfc01ac40b82b9ff2dd0a10219f3f030a3f) already exists.
2025-07-15 23:10:01.753678+00:002025-07-16 01:10:01.753 CEST [39] STATEMENT:  insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *


Additional information

Please make a list of smartphone blacklisted assets somewhere: this will help user to identifies them instead of digging inside logs or postgres DB.

Originally created by @ronzino83 on GitHub (Jul 16, 2025). ### I have searched the existing issues, both open and closed, to make sure this is not a duplicate report. - [x] Yes ### The bug When on mobile, the app is deleted/reinstalled (e.g. app cache and data clear, new smartphone, i.e. Smartphone Immich DB is lost) there is no way to realign server and mobile databases if storage template is enabled AND asset is moved before mobile DB drop: smartphone blacklists assets even if they reflect exactly the ones on server (same folders, same albums, same pictures). Other users (https://github.com/immich-app/immich/issues/15051) have run into the bug UQ_assets_owner_checksum after smartphone DB drop or assets movements back and forward, but reproduction steps are not given: mine follows, I hope now it will be possible to fix this ### The OS that Immich Server is running on Ubuntu 25.04 ### Version of Immich Server v1.135.3 ### Version of Immich Mobile App v1.135.1.build.202 Android playstore ### Platform with the issue - [x] Server - [ ] Web - [x] Mobile ### Your docker-compose.yml content ```YAML not relevant ``` ### Your .env content ```Shell not relevant ``` ### Reproduction steps 1.On Immich Server, enable Storage template {{album}} 2.On smartphone gallery create "Album1" and add asset "A" and "B" 3.On smartphone gallery create "Album2" and add asset "C" and "D" 4.On smartphone open Immich, add smartphone "Album1" and "Album2" to backup Assets and Sync _5.On server, folder "Album1", "Album2" are created 6.On server, album "Album1", "Album2" are created_ _7.On server, assets "A", "B", "C", "D" are uploaded and move in the right folders and albums._ 8.On smartphone gallery, move asset "B" from "Album1" to "Album2" 9.On smartphone open Immich app and Sync 10.On server, invoke "storage template migration" in order to reflect asset folder change _11. On server, asset "B" is moved (stored) in "Album2" folder 12. On server, asset "B" is listed both in "Album1" and "Album2" albums_ up to this everything works as expected. Now, lets trigger the bug. 13.On smartphone clear cache and data of Immich app 14.On smarphone open Immich, and configure again "Album1" and "Album2" to backup Assets _(please note that smartphone galleris content was keep untouched respect step 8. . So "Album1" contains only asset "A" while "Album2" contains "B", "C", "D"._ 15. Sync smartphone 16. _On server, notthing will change: folders albums assets are fine and not modified by smarpthone sync._ 17. _On smartphone, 1 element is warned as Duplicate blacklisted. Smartphone does not tell you that it is asset "B" . **This Duplicate blacklisted asset cannot be resolved or fixed and please note that it is a false positive as smartphone folder album asset are exactly the same on server ** _ 18. Clear duplicates on smartphone, and Sync trigger server LOG ERRORS 19. storge templeate migration on server, check duplicates on server, does not solve the blacklisting on smartphone. 20. Moving back on smartphone asset "B" to gallery "Album1" does not solve the problem 21. On server, removing asset "A" from "Album1" does not solve the problem In the following logs, i have 5 assets affected - 20250714_143859.jpg - IMG_20191218_233456.jpg - IMG_20231129_222804.jpg - IMG_20231129_222802.jpg - IMG_20231118_192102.jpg PLEASE NOTE: The asset "B" move from "Album1" to "Album2" is a bug precondition: if you don't move it, and do all the other steps, the bug is not triggered. ### Relevant log output ```shell SERVER LOG at point number 18 2025-07-15 23:10:00.073081+00:00Query failed : { 2025-07-15 23:10:00.073111+00:00durationMs: 1.6447380000026897, 2025-07-15 23:10:00.073119+00:00error: PostgresError: duplicate key value violates unique constraint "UQ_assets_owner_checksum" 2025-07-15 23:10:00.073126+00:00at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:790:26) 2025-07-15 23:10:00.073131+00:00at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:476:6) 2025-07-15 23:10:00.073137+00:00at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9) 2025-07-15 23:10:00.073144+00:00at Socket.emit (node:events:518:28) 2025-07-15 23:10:00.073149+00:00at addChunk (node:internal/streams/readable:561:12) 2025-07-15 23:10:00.073155+00:00at readableAddChunkPushByteMode (node:internal/streams/readable:512:3) 2025-07-15 23:10:00.073161+00:00at Readable.push (node:internal/streams/readable:392:5) 2025-07-15 23:10:00.073167+00:00at TCP.onStreamRead (node:internal/stream_base_commons:189:23) 2025-07-15 23:10:00.073173+00:00at TCP.callbackTrampoline (node:internal/async_hooks:130:17) { 2025-07-15 23:10:00.073179+00:00severity_local: 'ERROR', 2025-07-15 23:10:00.073189+00:00severity: 'ERROR', 2025-07-15 23:10:00.073195+00:00code: '23505', 2025-07-15 23:10:00.073202+00:00detail: 'Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \\x38aed7effed593e857753685e5f6a0c2092b2ebd) already exists.', 2025-07-15 23:10:00.073208+00:00schema_name: 'public', 2025-07-15 23:10:00.073215+00:00table_name: 'assets', 2025-07-15 23:10:00.073221+00:00constraint_name: 'UQ_assets_owner_checksum', 2025-07-15 23:10:00.073255+00:00file: 'nbtinsert.c', 2025-07-15 23:10:00.073286+00:00line: '664', 2025-07-15 23:10:00.073332+00:00routine: '_bt_check_unique' 2025-07-15 23:10:00.073342+00:00}, 2025-07-15 23:10:00.073349+00:00sql: 'insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *', 2025-07-15 23:10:00.073358+00:00params: [ 2025-07-15 23:10:00.073365+00:00'e1dcc5af-7ed6-452e-a703-71426f3503f2', 2025-07-15 23:10:00.073372+00:00null, 2025-07-15 23:10:00.073378+00:00<Buffer 38 ae d7 ef fe d5 93 e8 57 75 36 85 e5 f6 a0 c2 09 2b 2e bd>, 2025-07-15 23:10:00.073384+00:00'upload/upload/e1dcc5af-7ed6-452e-a703-71426f3503f2/83/82/83822a1d-ecdf-4e0b-a8ec-1c870e98e15a.jpg', 2025-07-15 23:10:00.073406+00:00'1000091368', 2025-07-15 23:10:00.073418+00:00'9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a', 2025-07-15 23:10:00.073425+00:002025-07-14T12:39:00.000Z, 2025-07-15 23:10:00.073432+00:002025-07-14T12:39:02.000Z, 2025-07-15 23:10:00.073438+00:002025-07-14T12:39:00.000Z, 2025-07-15 23:10:00.073444+00:00'IMAGE', 2025-07-15 23:10:00.073451+00:00false, 2025-07-15 23:10:00.073457+00:00'0:00:00.000000', 2025-07-15 23:10:00.073464+00:00'timeline', 2025-07-15 23:10:00.073470+00:00'20250714_143859.jpg' 2025-07-15 23:10:00.073476+00:00] 2025-07-15 23:10:00.073484+00:00} 2025-07-15 23:10:00.075363+00:00[Nest] 24 - 07/16/2025, 1:10:00 AM  DEBUG [Api:LoggingInterceptor~cosylh9k] POST /api/assets 200 250.76ms ::ffff:192.168.119.36 2025-07-15 23:10:00.075415+00:00[Nest] 24 - 07/16/2025, 1:10:00 AM VERBOSE [Api:LoggingInterceptor~cosylh9k] {"deviceAssetId":"1000091368","deviceId":"9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a","fileCreatedAt":"2025-07-14T12:39:00.000Z","fileModifiedAt":"2025-07-14T12:39:02.000Z","isFavorite":"false","duration":"0:00:00.000000"} 2025-07-15 23:10:00.088932+00:00[Nest] 24 - 07/16/2025, 1:10:00 AM  DEBUG [Api:LoggingInterceptor~09v7ykv4] GET /api/server/storage 200 0.30ms ::ffff:192.168.119.36 2025-07-15 23:10:00.113211+00:00[Nest] 24 - 07/16/2025, 1:10:00 AM  DEBUG [Api:LoggingInterceptor~p0dut6yw] PUT /api/albums/0d99f1ed-b00c-41c3-a4f8-b8eafdf1b0f6/assets 200 3.51ms ::ffff:192.168.119.36 2025-07-15 23:10:00.113267+00:00[Nest] 24 - 07/16/2025, 1:10:00 AM VERBOSE [Api:LoggingInterceptor~p0dut6yw] {"ids":["8661d6c6-1369-4ef9-ab63-789949ba5892"]} 2025-07-15 23:10:00.444832+00:00Query failed : { 2025-07-15 23:10:00.444871+00:00durationMs: 1.821866000071168, 2025-07-15 23:10:00.444881+00:00error: PostgresError: duplicate key value violates unique constraint "UQ_assets_owner_checksum" 2025-07-15 23:10:00.444888+00:00at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:790:26) 2025-07-15 23:10:00.444895+00:00at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:476:6) 2025-07-15 23:10:00.444902+00:00at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9) 2025-07-15 23:10:00.444908+00:00at Socket.emit (node:events:518:28) 2025-07-15 23:10:00.444914+00:00at addChunk (node:internal/streams/readable:561:12) 2025-07-15 23:10:00.444920+00:00at readableAddChunkPushByteMode (node:internal/streams/readable:512:3) 2025-07-15 23:10:00.444927+00:00at Readable.push (node:internal/streams/readable:392:5) 2025-07-15 23:10:00.444933+00:00at TCP.onStreamRead (node:internal/stream_base_commons:189:23) 2025-07-15 23:10:00.444939+00:00at TCP.callbackTrampoline (node:internal/async_hooks:130:17) { 2025-07-15 23:10:00.444945+00:00severity_local: 'ERROR', 2025-07-15 23:10:00.444951+00:00severity: 'ERROR', 2025-07-15 23:10:00.444957+00:00code: '23505', 2025-07-15 23:10:00.444964+00:00detail: 'Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \\xf24158fd589c1c4ab04772e922fad59f0fd07584) already exists.', 2025-07-15 23:10:00.444972+00:00schema_name: 'public', 2025-07-15 23:10:00.444982+00:00table_name: 'assets', 2025-07-15 23:10:00.444988+00:00constraint_name: 'UQ_assets_owner_checksum', 2025-07-15 23:10:00.444995+00:00file: 'nbtinsert.c', 2025-07-15 23:10:00.445001+00:00line: '664', 2025-07-15 23:10:00.445007+00:00routine: '_bt_check_unique' 2025-07-15 23:10:00.445013+00:00}, 2025-07-15 23:10:00.445019+00:00sql: 'insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *', 2025-07-15 23:10:00.445049+00:00params: [ 2025-07-15 23:10:00.445057+00:00'e1dcc5af-7ed6-452e-a703-71426f3503f2', 2025-07-15 23:10:00.445064+00:00null, 2025-07-15 23:10:00.445071+00:00<Buffer f2 41 58 fd 58 9c 1c 4a b0 47 72 e9 22 fa d5 9f 0f d0 75 84>, 2025-07-15 23:10:00.445078+00:00'upload/upload/e1dcc5af-7ed6-452e-a703-71426f3503f2/77/8d/778d094b-d549-4e76-9122-cdc2606180c2.jpg', 2025-07-15 23:10:00.445084+00:00'1000090605', 2025-07-15 23:10:00.445090+00:00'9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a', 2025-07-15 23:10:00.445097+00:002019-12-19T02:34:56.000Z, 2025-07-15 23:10:00.445104+00:002024-02-03T00:03:51.000Z, 2025-07-15 23:10:00.445110+00:002019-12-19T02:34:56.000Z, 2025-07-15 23:10:00.445116+00:00'IMAGE', 2025-07-15 23:10:00.445122+00:00false, 2025-07-15 23:10:00.445128+00:00'0:00:00.000000', 2025-07-15 23:10:00.445135+00:00'timeline', 2025-07-15 23:10:00.445141+00:00'IMG_20191218_233456.jpg' 2025-07-15 23:10:00.445148+00:00] 2025-07-15 23:10:00.445154+00:00} 2025-07-15 23:10:00.446932+00:00[Nest] 24 - 07/16/2025, 1:10:00 AM  DEBUG [Api:LoggingInterceptor~wjvdvb28] POST /api/assets 200 285.40ms ::ffff:192.168.119.36 2025-07-15 23:10:00.447012+00:00[Nest] 24 - 07/16/2025, 1:10:00 AM VERBOSE [Api:LoggingInterceptor~wjvdvb28] {"deviceAssetId":"1000090605","deviceId":"9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a","fileCreatedAt":"2019-12-19T02:34:56.000Z","fileModifiedAt":"2024-02-03T00:03:51.000Z","isFavorite":"false","duration":"0:00:00.000000"} 2025-07-15 23:10:00.461303+00:00[Nest] 24 - 07/16/2025, 1:10:00 AM  DEBUG [Api:LoggingInterceptor~whrbbg5k] GET /api/server/storage 200 0.64ms ::ffff:192.168.119.36 2025-07-15 23:10:00.466340+00:00[Nest] 24 - 07/16/2025, 1:10:00 AM  DEBUG [Api:LoggingInterceptor~4l33io98] PUT /api/albums/0d99f1ed-b00c-41c3-a4f8-b8eafdf1b0f6/assets 200 2.80ms ::ffff:192.168.119.36 2025-07-15 23:10:00.466391+00:00[Nest] 24 - 07/16/2025, 1:10:00 AM VERBOSE [Api:LoggingInterceptor~4l33io98] {"ids":["eecaaf83-b4a9-4010-88cc-ad2919a77de9"]} 2025-07-15 23:10:00.942952+00:00Query failed : { 2025-07-15 23:10:00.942995+00:00durationMs: 1.696460000006482, 2025-07-15 23:10:00.943006+00:00error: PostgresError: duplicate key value violates unique constraint "UQ_assets_owner_checksum" 2025-07-15 23:10:00.943014+00:00at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:790:26) 2025-07-15 23:10:00.943021+00:00at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:476:6) 2025-07-15 23:10:00.943028+00:00at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9) 2025-07-15 23:10:00.943035+00:00at Socket.emit (node:events:518:28) 2025-07-15 23:10:00.943046+00:00at addChunk (node:internal/streams/readable:561:12) 2025-07-15 23:10:00.943053+00:00at readableAddChunkPushByteMode (node:internal/streams/readable:512:3) 2025-07-15 23:10:00.943059+00:00at Readable.push (node:internal/streams/readable:392:5) 2025-07-15 23:10:00.943066+00:00at TCP.onStreamRead (node:internal/stream_base_commons:189:23) 2025-07-15 23:10:00.943073+00:00at TCP.callbackTrampoline (node:internal/async_hooks:130:17) { 2025-07-15 23:10:00.943079+00:00severity_local: 'ERROR', 2025-07-15 23:10:00.943086+00:00severity: 'ERROR', 2025-07-15 23:10:00.943093+00:00code: '23505', 2025-07-15 23:10:00.943101+00:00detail: 'Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \\x72e15a76036c1cb7ff119784fe8c9bb67282b8ca) already exists.', 2025-07-15 23:10:00.943108+00:00schema_name: 'public', 2025-07-15 23:10:00.943114+00:00table_name: 'assets', 2025-07-15 23:10:00.943121+00:00constraint_name: 'UQ_assets_owner_checksum', 2025-07-15 23:10:00.943128+00:00file: 'nbtinsert.c', 2025-07-15 23:10:00.943135+00:00line: '664', 2025-07-15 23:10:00.943141+00:00routine: '_bt_check_unique' 2025-07-15 23:10:00.943148+00:00}, 2025-07-15 23:10:00.943156+00:00sql: 'insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *', 2025-07-15 23:10:00.943165+00:00params: [ 2025-07-15 23:10:00.943171+00:00'e1dcc5af-7ed6-452e-a703-71426f3503f2', 2025-07-15 23:10:00.943178+00:00null, 2025-07-15 23:10:00.943185+00:00<Buffer 72 e1 5a 76 03 6c 1c b7 ff 11 97 84 fe 8c 9b b6 72 82 b8 ca>, 2025-07-15 23:10:00.943193+00:00'upload/upload/e1dcc5af-7ed6-452e-a703-71426f3503f2/1c/6f/1c6ff236-c773-4d21-aba3-3a3354eb2a0d.jpg', 2025-07-15 23:10:00.943200+00:00'1000090604', 2025-07-15 23:10:00.943207+00:00'9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a', 2025-07-15 23:10:00.943214+00:002023-11-29T21:28:06.000Z, 2025-07-15 23:10:00.943221+00:002024-02-03T00:01:41.000Z, 2025-07-15 23:10:00.943228+00:002023-11-29T21:28:06.000Z, 2025-07-15 23:10:00.943234+00:00'IMAGE', 2025-07-15 23:10:00.943242+00:00false, 2025-07-15 23:10:00.943249+00:00'0:00:00.000000', 2025-07-15 23:10:00.943256+00:00'timeline', 2025-07-15 23:10:00.943264+00:00'IMG_20231129_222804.jpg' 2025-07-15 23:10:00.943272+00:00] 2025-07-15 23:10:00.943279+00:00} 2025-07-15 23:10:00.946266+00:00[Nest] 24 - 07/16/2025, 1:10:00 AM  DEBUG [Api:LoggingInterceptor~524l0eg8] POST /api/assets 200 433.49ms ::ffff:192.168.119.36 2025-07-15 23:10:00.946343+00:00[Nest] 24 - 07/16/2025, 1:10:00 AM VERBOSE [Api:LoggingInterceptor~524l0eg8] {"deviceAssetId":"1000090604","deviceId":"9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a","fileCreatedAt":"2023-11-29T21:28:06.000Z","fileModifiedAt":"2024-02-03T00:01:41.000Z","isFavorite":"false","duration":"0:00:00.000000"} 2025-07-15 23:10:00.959643+00:00[Nest] 24 - 07/16/2025, 1:10:00 AM  DEBUG [Api:LoggingInterceptor~wy3u5wb4] GET /api/server/storage 200 1.36ms ::ffff:192.168.119.36 2025-07-15 23:10:00.964299+00:00[Nest] 24 - 07/16/2025, 1:10:00 AM  DEBUG [Api:LoggingInterceptor~it9q7c0n] PUT /api/albums/0d99f1ed-b00c-41c3-a4f8-b8eafdf1b0f6/assets 200 3.18ms ::ffff:192.168.119.36 2025-07-15 23:10:00.964368+00:00[Nest] 24 - 07/16/2025, 1:10:00 AM VERBOSE [Api:LoggingInterceptor~it9q7c0n] {"ids":["8adc5cd3-5dd2-4bc3-aace-444fedcedbbd"]} 2025-07-15 23:10:01.370354+00:00Query failed : { 2025-07-15 23:10:01.370398+00:00durationMs: 1.4982359999557957, 2025-07-15 23:10:01.370409+00:00error: PostgresError: duplicate key value violates unique constraint "UQ_assets_owner_checksum" 2025-07-15 23:10:01.370417+00:00at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:790:26) 2025-07-15 23:10:01.370425+00:00at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:476:6) 2025-07-15 23:10:01.370432+00:00at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9) 2025-07-15 23:10:01.370439+00:00at Socket.emit (node:events:518:28) 2025-07-15 23:10:01.370446+00:00at addChunk (node:internal/streams/readable:561:12) 2025-07-15 23:10:01.370453+00:00at readableAddChunkPushByteMode (node:internal/streams/readable:512:3) 2025-07-15 23:10:01.370460+00:00at Readable.push (node:internal/streams/readable:392:5) 2025-07-15 23:10:01.370467+00:00at TCP.onStreamRead (node:internal/stream_base_commons:189:23) 2025-07-15 23:10:01.370474+00:00at TCP.callbackTrampoline (node:internal/async_hooks:130:17) { 2025-07-15 23:10:01.370480+00:00severity_local: 'ERROR', 2025-07-15 23:10:01.370492+00:00severity: 'ERROR', 2025-07-15 23:10:01.370499+00:00code: '23505', 2025-07-15 23:10:01.370506+00:00detail: 'Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \\xce18be7c42a71088f4fd4eee10fc1c14367df28d) already exists.', 2025-07-15 23:10:01.370513+00:00schema_name: 'public', 2025-07-15 23:10:01.370520+00:00table_name: 'assets', 2025-07-15 23:10:01.370527+00:00constraint_name: 'UQ_assets_owner_checksum', 2025-07-15 23:10:01.370534+00:00file: 'nbtinsert.c', 2025-07-15 23:10:01.370541+00:00line: '664', 2025-07-15 23:10:01.370551+00:00routine: '_bt_check_unique' 2025-07-15 23:10:01.370557+00:00}, 2025-07-15 23:10:01.370565+00:00sql: 'insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *', 2025-07-15 23:10:01.370573+00:00params: [ 2025-07-15 23:10:01.370580+00:00'e1dcc5af-7ed6-452e-a703-71426f3503f2', 2025-07-15 23:10:01.370587+00:00null, 2025-07-15 23:10:01.370595+00:00<Buffer ce 18 be 7c 42 a7 10 88 f4 fd 4e ee 10 fc 1c 14 36 7d f2 8d>, 2025-07-15 23:10:01.370603+00:00'upload/upload/e1dcc5af-7ed6-452e-a703-71426f3503f2/88/ca/88ca8531-1e07-458d-aff5-0021a500156f.jpg', 2025-07-15 23:10:01.370611+00:00'1000090602', 2025-07-15 23:10:01.370621+00:00'9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a', 2025-07-15 23:10:01.370629+00:002023-11-29T21:28:04.000Z, 2025-07-15 23:10:01.370636+00:002024-02-03T00:01:40.000Z, 2025-07-15 23:10:01.370643+00:002023-11-29T21:28:04.000Z, 2025-07-15 23:10:01.370650+00:00'IMAGE', 2025-07-15 23:10:01.370657+00:00false, 2025-07-15 23:10:01.370664+00:00'0:00:00.000000', 2025-07-15 23:10:01.370671+00:00'timeline', 2025-07-15 23:10:01.370678+00:00'IMG_20231129_222802.jpg' 2025-07-15 23:10:01.370685+00:00] 2025-07-15 23:10:01.370692+00:00} 2025-07-15 23:10:01.373271+00:00[Nest] 24 - 07/16/2025, 1:10:01 AM  DEBUG [Api:LoggingInterceptor~qe8ve2da] POST /api/assets 200 369.99ms ::ffff:192.168.119.36 2025-07-15 23:10:01.373354+00:00[Nest] 24 - 07/16/2025, 1:10:01 AM VERBOSE [Api:LoggingInterceptor~qe8ve2da] {"deviceAssetId":"1000090602","deviceId":"9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a","fileCreatedAt":"2023-11-29T21:28:04.000Z","fileModifiedAt":"2024-02-03T00:01:40.000Z","isFavorite":"false","duration":"0:00:00.000000"} 2025-07-15 23:10:01.385632+00:00[Nest] 24 - 07/16/2025, 1:10:01 AM  DEBUG [Api:LoggingInterceptor~m0vocnhw] GET /api/server/storage 200 0.45ms ::ffff:192.168.119.36 2025-07-15 23:10:01.391802+00:00[Nest] 24 - 07/16/2025, 1:10:01 AM  DEBUG [Api:LoggingInterceptor~uoagu5fe] PUT /api/albums/0d99f1ed-b00c-41c3-a4f8-b8eafdf1b0f6/assets 200 3.56ms ::ffff:192.168.119.36 2025-07-15 23:10:01.391862+00:00[Nest] 24 - 07/16/2025, 1:10:01 AM VERBOSE [Api:LoggingInterceptor~uoagu5fe] {"ids":["5792d195-0c26-4f09-a312-6a7e34343cc8"]} 2025-07-15 23:10:01.757427+00:00Query failed : { 2025-07-15 23:10:01.757491+00:00durationMs: 14.300225000013597, 2025-07-15 23:10:01.757501+00:00error: PostgresError: duplicate key value violates unique constraint "UQ_assets_owner_checksum" 2025-07-15 23:10:01.757510+00:00at ErrorResponse (/usr/src/app/node_modules/postgres/cjs/src/connection.js:790:26) 2025-07-15 23:10:01.757518+00:00at handle (/usr/src/app/node_modules/postgres/cjs/src/connection.js:476:6) 2025-07-15 23:10:01.757525+00:00at Socket.data (/usr/src/app/node_modules/postgres/cjs/src/connection.js:315:9) 2025-07-15 23:10:01.757532+00:00at Socket.emit (node:events:518:28) 2025-07-15 23:10:01.757539+00:00at addChunk (node:internal/streams/readable:561:12) 2025-07-15 23:10:01.757546+00:00at readableAddChunkPushByteMode (node:internal/streams/readable:512:3) 2025-07-15 23:10:01.757553+00:00at Readable.push (node:internal/streams/readable:392:5) 2025-07-15 23:10:01.757560+00:00at TCP.onStreamRead (node:internal/stream_base_commons:189:23) 2025-07-15 23:10:01.757567+00:00at TCP.callbackTrampoline (node:internal/async_hooks:130:17) { 2025-07-15 23:10:01.757574+00:00severity_local: 'ERROR', 2025-07-15 23:10:01.757581+00:00severity: 'ERROR', 2025-07-15 23:10:01.757587+00:00code: '23505', 2025-07-15 23:10:01.757594+00:00detail: 'Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \\x6a928dfc01ac40b82b9ff2dd0a10219f3f030a3f) already exists.', 2025-07-15 23:10:01.757601+00:00schema_name: 'public', 2025-07-15 23:10:01.757608+00:00table_name: 'assets', 2025-07-15 23:10:01.757615+00:00constraint_name: 'UQ_assets_owner_checksum', 2025-07-15 23:10:01.757623+00:00file: 'nbtinsert.c', 2025-07-15 23:10:01.757630+00:00line: '664', 2025-07-15 23:10:01.757637+00:00routine: '_bt_check_unique' 2025-07-15 23:10:01.757648+00:00}, 2025-07-15 23:10:01.757656+00:00sql: 'insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning *', 2025-07-15 23:10:01.757665+00:00params: [ 2025-07-15 23:10:01.757672+00:00'e1dcc5af-7ed6-452e-a703-71426f3503f2', 2025-07-15 23:10:01.757678+00:00null, 2025-07-15 23:10:01.757685+00:00<Buffer 6a 92 8d fc 01 ac 40 b8 2b 9f f2 dd 0a 10 21 9f 3f 03 0a 3f>, 2025-07-15 23:10:01.757692+00:00'upload/upload/e1dcc5af-7ed6-452e-a703-71426f3503f2/85/5b/855bdb22-3871-4ca9-824f-0d14d2e2867e.jpg', 2025-07-15 23:10:01.757699+00:00'1000016458', 2025-07-15 23:10:01.757706+00:00'9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a', 2025-07-15 23:10:01.757713+00:002023-11-18T18:21:04.000Z, 2025-07-15 23:10:01.757720+00:002024-02-03T00:01:36.000Z, 2025-07-15 23:10:01.757726+00:002023-11-18T18:21:04.000Z, 2025-07-15 23:10:01.757733+00:00'IMAGE', 2025-07-15 23:10:01.757740+00:00false, 2025-07-15 23:10:01.757747+00:00'0:00:00.000000', 2025-07-15 23:10:01.757754+00:00'timeline', 2025-07-15 23:10:01.757761+00:00'IMG_20231118_192102.jpg' 2025-07-15 23:10:01.757768+00:00] 2025-07-15 23:10:01.757775+00:00} -------------------------------------------- SMARPTHONE LOG at point number 18 does not contains relevant information about duplicate blacklisting __________________________________________ POSTGRES LOG 2025-07-15 23:03:03.428202+00:002025-07-16 01:03:03.427 CEST [39] ERROR: duplicate key value violates unique constraint "UQ_assets_owner_checksum" 2025-07-15 23:03:03.428245+00:002025-07-16 01:03:03.427 CEST [39] DETAIL: Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \x38aed7effed593e857753685e5f6a0c2092b2ebd) already exists. 2025-07-15 23:03:03.428266+00:002025-07-16 01:03:03.427 CEST [39] STATEMENT: insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning * 2025-07-15 23:03:03.912889+00:002025-07-16 01:03:03.912 CEST [38] ERROR: duplicate key value violates unique constraint "UQ_assets_owner_checksum" 2025-07-15 23:03:03.912924+00:002025-07-16 01:03:03.912 CEST [38] DETAIL: Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \xf24158fd589c1c4ab04772e922fad59f0fd07584) already exists. 2025-07-15 23:03:03.912944+00:002025-07-16 01:03:03.912 CEST [38] STATEMENT: insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning * 2025-07-15 23:03:04.357671+00:002025-07-16 01:03:04.357 CEST [40] ERROR: duplicate key value violates unique constraint "UQ_assets_owner_checksum" 2025-07-15 23:03:04.357714+00:002025-07-16 01:03:04.357 CEST [40] DETAIL: Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \x72e15a76036c1cb7ff119784fe8c9bb67282b8ca) already exists. 2025-07-15 23:03:04.357723+00:002025-07-16 01:03:04.357 CEST [40] STATEMENT: insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning * 2025-07-15 23:03:04.766748+00:002025-07-16 01:03:04.766 CEST [39] ERROR: duplicate key value violates unique constraint "UQ_assets_owner_checksum" 2025-07-15 23:03:04.766774+00:002025-07-16 01:03:04.766 CEST [39] DETAIL: Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \xce18be7c42a71088f4fd4eee10fc1c14367df28d) already exists. 2025-07-15 23:03:04.766794+00:002025-07-16 01:03:04.766 CEST [39] STATEMENT: insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning * 2025-07-15 23:03:05.356720+00:002025-07-16 01:03:05.356 CEST [38] ERROR: duplicate key value violates unique constraint "UQ_assets_owner_checksum" 2025-07-15 23:03:05.356773+00:002025-07-16 01:03:05.356 CEST [38] DETAIL: Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \x6a928dfc01ac40b82b9ff2dd0a10219f3f030a3f) already exists. 2025-07-15 23:03:05.356798+00:002025-07-16 01:03:05.356 CEST [38] STATEMENT: insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning * 2025-07-15 23:07:30.793459+00:002025-07-16 01:07:30.793 CEST [18] LOG: checkpoint starting: time 2025-07-15 23:07:32.612034+00:002025-07-16 01:07:32.611 CEST [18] LOG: checkpoint complete: wrote 19 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=1.806 s, sync=0.009 s, total=1.819 s; sync files=9, longest=0.002 s, average=0.001 s; distance=49 kB, estimate=49 kB 2025-07-15 23:10:00.072624+00:002025-07-16 01:10:00.072 CEST [40] ERROR: duplicate key value violates unique constraint "UQ_assets_owner_checksum" 2025-07-15 23:10:00.072679+00:002025-07-16 01:10:00.072 CEST [40] DETAIL: Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \x38aed7effed593e857753685e5f6a0c2092b2ebd) already exists. 2025-07-15 23:10:00.072687+00:002025-07-16 01:10:00.072 CEST [40] STATEMENT: insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning * 2025-07-15 23:10:00.444172+00:002025-07-16 01:10:00.443 CEST [39] ERROR: duplicate key value violates unique constraint "UQ_assets_owner_checksum" 2025-07-15 23:10:00.444216+00:002025-07-16 01:10:00.443 CEST [39] DETAIL: Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \xf24158fd589c1c4ab04772e922fad59f0fd07584) already exists. 2025-07-15 23:10:00.444223+00:002025-07-16 01:10:00.443 CEST [39] STATEMENT: insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning * 2025-07-15 23:10:00.942376+00:002025-07-16 01:10:00.942 CEST [38] ERROR: duplicate key value violates unique constraint "UQ_assets_owner_checksum" 2025-07-15 23:10:00.942412+00:002025-07-16 01:10:00.942 CEST [38] DETAIL: Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \x72e15a76036c1cb7ff119784fe8c9bb67282b8ca) already exists. 2025-07-15 23:10:00.942441+00:002025-07-16 01:10:00.942 CEST [38] STATEMENT: insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning * 2025-07-15 23:10:01.369391+00:002025-07-16 01:10:01.369 CEST [40] ERROR: duplicate key value violates unique constraint "UQ_assets_owner_checksum" 2025-07-15 23:10:01.369427+00:002025-07-16 01:10:01.369 CEST [40] DETAIL: Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \xce18be7c42a71088f4fd4eee10fc1c14367df28d) already exists. 2025-07-15 23:10:01.369435+00:002025-07-16 01:10:01.369 CEST [40] STATEMENT: insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning * 2025-07-15 23:10:01.753602+00:002025-07-16 01:10:01.753 CEST [39] ERROR: duplicate key value violates unique constraint "UQ_assets_owner_checksum" 2025-07-15 23:10:01.753664+00:002025-07-16 01:10:01.753 CEST [39] DETAIL: Key ("ownerId", checksum)=(e1dcc5af-7ed6-452e-a703-71426f3503f2, \x6a928dfc01ac40b82b9ff2dd0a10219f3f030a3f) already exists. 2025-07-15 23:10:01.753678+00:002025-07-16 01:10:01.753 CEST [39] STATEMENT: insert into "assets" ("ownerId", "libraryId", "checksum", "originalPath", "deviceAssetId", "deviceId", "fileCreatedAt", "fileModifiedAt", "localDateTime", "type", "isFavorite", "duration", "visibility", "originalFileName") values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14) returning * ``` ### Additional information Please make a list of smartphone blacklisted assets somewhere: this will help user to identifies them instead of digging inside logs or postgres DB.
Author
Owner

@bo0tzz commented on GitHub (Jul 16, 2025):

I don't quite understand what you're describing, this sounds like the anti-duplicate mechanism is working exactly as expected?

@bo0tzz commented on GitHub (Jul 16, 2025): I don't quite understand what you're describing, this sounds like the anti-duplicate mechanism is working exactly as expected?
Author
Owner

@ronzino83 commented on GitHub (Jul 16, 2025):

I don't quite understand what you're describing, this sounds like the anti-duplicate mechanism is working exactly as expected?

It is working in wrong way: it is like it is say "you have successfully uploaded your asset "B".....let me check again ..... ERROR you are trying to upload asset "B", it is duplicate "

this is not correct mechanism
if this would have be the right behavior, we should see thousand and thousand of those errors for every assets we have.

here my app is trying to upload 5 assets that are in the exact same smartphone folder, same album name all the same BUT after a smartphone DB drop, those 5 trigger anti-duplication.
in the same smartphone, i have other 751 assets in another gallery folder, never moved never touched, and thosedo not trigger anti-duplicate

**so the question is: why those 5 assets trigger anti-duplicate and the other 751 no ? which is the difference **

answer: because those 5 assets was moved on smartphone between its folders BEFORE db drop. The relocations was fine both for server and smartphone, no warning no error, after storage migration, the 5 asset where moved to the right folder and assigned to the new album as well (new after relocation, old before). It is the expected behavior.

BUT

Then, a smartphone db drop occurs, log in, reselect the smartphone gallery album that have to be in sync (the exact the same before). The 751 assets never moved are ok, resync with no errors. The other 5 assets rise error BUT please note that the movements where made and well synced before DB drop, not later. this means that the actual server DB and folder replicate exactly the structure on smartphone.

I guess this
when a synced asset is MOVED/RELOCATED on smartphone, server DB and smartphone DB keep track of this, immich storage templete relocate file, and assign the asset to the corresponding immich albums. But if the smartphone loses its db, and even if assest are in the exact same folder/gallery position on it, DBs are not more able to align again. It looks like the old (before movement) data is used in some asset duplication checks, and this is wrong. It must use the new position, not the old one

@ronzino83 commented on GitHub (Jul 16, 2025): > I don't quite understand what you're describing, this sounds like the anti-duplicate mechanism is working exactly as expected? It is working in wrong way: it is like it is say "you have successfully uploaded your asset "B".....let me check again ..... ERROR you are trying to upload asset "B", it is duplicate " this is not correct mechanism if this would have be the right behavior, we should see thousand and thousand of those errors for every assets we have. here my app is trying to upload 5 assets that are in the exact same smartphone folder, same album name all the same BUT after a smartphone DB drop, those 5 trigger anti-duplication. in the same smartphone, i have other 751 assets in another gallery folder, never moved never touched, and thosedo not trigger anti-duplicate **so the question is: why those 5 assets trigger anti-duplicate and the other 751 no ? which is the difference ** answer: because those 5 assets was moved on smartphone between its folders BEFORE db drop. The relocations was fine both for server and smartphone, no warning no error, after storage migration, the 5 asset where moved to the right folder and assigned to the new album as well (new after relocation, old before). It is the expected behavior. **BUT** Then, a smartphone db drop occurs, log in, reselect the smartphone gallery album that have to be in sync (the exact the same before). The 751 assets never moved are ok, resync with no errors. The other 5 assets rise error BUT please note that the movements where made and well synced before DB drop, not later. this means that the actual server DB and folder replicate exactly the structure on smartphone. **I guess this** when a synced asset is MOVED/RELOCATED on smartphone, server DB and smartphone DB keep track of this, immich storage templete relocate file, and assign the asset to the corresponding immich albums. But if the smartphone loses its db, and even if assest are in the exact same folder/gallery position on it, DBs are not more able to align again. It looks like the old (before movement) data is used in some asset duplication checks, and this is wrong. It must use the new position, not the old one
Author
Owner

@ronzino83 commented on GitHub (Jul 16, 2025):

Let me show a tangible situation.
Look at file 20250714_143859.jpg in the posted logs.

On my smartphone gallery i have and album TestAlbum2, cirlend in red-green you have the asset that generate the problem 20250714_143859.jpg


Image

Full path on smartphone

Image

On immch app on my smartphone this asset is synced

Image

BUT this asset is one of the 5 blacklisted duplicates

Image

On immich server the asset is synced as well, placed in the right album and in the corresponding server folder that match with storage template

Image

SO WHY THIS ASSET IS BLACKLISTED ?

i will dig a bit into postgres DB and revert

@ronzino83 commented on GitHub (Jul 16, 2025): Let me show a tangible situation. Look at file 20250714_143859.jpg in the posted logs. On my smartphone gallery i have and album TestAlbum2, cirlend in red-green you have the asset that generate the problem 20250714_143859.jpg ------------------------------------------------------------------- <img width="236" height="454" alt="Image" src="https://github.com/user-attachments/assets/fd79c3f8-91ee-46f9-a3e2-864a0011b0f8" /> ------------------------------------------------------------------- Full path on smartphone <img width="501" height="560" alt="Image" src="https://github.com/user-attachments/assets/ca9b6df0-7a8b-42ad-9f0f-70b9422ba912" /> ------------------------------------------------------------------- On immch app on my smartphone this asset is synced <img width="299" height="252" alt="Image" src="https://github.com/user-attachments/assets/5461c78e-492e-402c-8935-8f2e5d824309" /> ------------------------------------------------------------------- BUT this asset is one of the 5 blacklisted duplicates <img width="463" height="116" alt="Image" src="https://github.com/user-attachments/assets/1c93f123-0dd3-4f37-934c-c724b289c240" /> ------------------------------------------------------------------- On immich server the asset is synced as well, placed in the right album and in the corresponding server folder that match with storage template <img width="1405" height="608" alt="Image" src="https://github.com/user-attachments/assets/3dee5eb4-fc7c-42e9-a871-0b686685123c" /> ------------------------------------------------------------------- SO WHY THIS ASSET IS BLACKLISTED ? i will dig a bit into postgres DB and revert
Author
Owner

@ronzino83 commented on GitHub (Jul 16, 2025):

on postegres DB, according to the LOG, the mentioned file 20250714_143859.jpg has this checksum 38aed7effed593e857753685e5f6a0c2092b2ebd

SELECT *
FROM public.assets
WHERE checksum = decode('38aed7effed593e857753685e5f6a0c2092b2ebd', 'hex');
"id"                    "8661d6c6-1369-4ef9-ab63-789949ba5892"
"deviceAssetId"         "1000090588"
"ownerId"               "e1dcc5af-7ed6-452e-a703-71426f3503f2"
"deviceId"              "9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a"
"type"                  "IMAGE"
"originalPath"          "upload/library/admin/201912_TestAlbum2/20250714_143859.jpg"
"fileCreatedAt"         "2025-07-14 14:39:00.145+02"
"fileModifiedAt"        "2025-07-14 14:39:02+02"
"isFavorite"            false
"duration"              [null]
"encodedVideoPath"      
"checksum"              [binary data]
"livePhotoVideoId"      [null]
"updatedAt"             "2025-07-15 23:44:59.459927+02"
"createdAt"             "2025-07-15 11:17:36.99193+02"
"originalFileName"      "20250714_143859.jpg"
"sidecarPath"           [null]
"thumbhash"             [binary data]
"isOffline"             false
"libraryId"             [null]
"isExternal"            false
"deletedAt"             [null]
"localDateTime"         "2025-07-14 16:39:00.145+02"
"stackId"               [null]
"duplicateId"           [null]
"status"                "active"
"updateId"              "0198100c-5143-7977-9c5f-df69f21a018e"
"visibility"            "timeline"

Only this asset is present with that checksum

also looking for this asset ID 8661d6c6-1369-4ef9-ab63-789949ba5892, it appears to be correct

DO $$
DECLARE
    rec RECORD;
    search_value TEXT := '8661d6c6-1369-4ef9-ab63-789949ba5892'; 
    query TEXT;
    found_count INTEGER;
BEGIN
    RAISE NOTICE 'Searching for value: %', search_value;

    FOR rec IN
        SELECT
            table_schema,
            table_name,
            column_name
        FROM
            information_schema.columns
        WHERE
            table_schema NOT IN ('pg_catalog', 'information_schema') 
            AND data_type IN ('text', 'character varying', 'uuid', 'char') 
    LOOP
        BEGIN
            query := format(
                'SELECT COUNT(*) FROM %I.%I WHERE CAST(%I AS TEXT) = %L',
                rec.table_schema,
                rec.table_name,
                rec.column_name,
                search_value
            );

            EXECUTE query INTO found_count;

            IF found_count > 0 THEN
                RAISE NOTICE 'Found "%" in %.% (Column: %, Count: %)',
                                search_value,
                                rec.table_schema,
                                rec.table_name,
                                rec.column_name,
                                found_count;
            END IF;

        EXCEPTION
            WHEN OTHERS THEN
                RAISE WARNING 'Could not query %.% (Column: %): %',
                                rec.table_schema,
                                rec.table_name,
                                rec.column_name,
                                SQLERRM;
        END;
    END LOOP;
    RAISE NOTICE 'Search complete.';
END $$;
NOTICE:  Searching for value: 8661d6c6-1369-4ef9-ab63-789949ba5892
NOTICE:  Found "8661d6c6-1369-4ef9-ab63-789949ba5892" in public.albums_assets_assets (Column: assetsId, Count: 1)
NOTICE:  Found "8661d6c6-1369-4ef9-ab63-789949ba5892" in public.asset_files (Column: assetId, Count: 2)
NOTICE:  Found "8661d6c6-1369-4ef9-ab63-789949ba5892" in public.asset_job_status (Column: assetId, Count: 1)
NOTICE:  Found "8661d6c6-1369-4ef9-ab63-789949ba5892" in public.exif (Column: assetId, Count: 1)
NOTICE:  Found "8661d6c6-1369-4ef9-ab63-789949ba5892" in public.smart_search (Column: assetId, Count: 1)
NOTICE:  Found "8661d6c6-1369-4ef9-ab63-789949ba5892" in public.assets (Column: id, Count: 1)
NOTICE:  Search complete.
@ronzino83 commented on GitHub (Jul 16, 2025): on postegres DB, according to the LOG, the mentioned file 20250714_143859.jpg has this checksum 38aed7effed593e857753685e5f6a0c2092b2ebd ``` SELECT * FROM public.assets WHERE checksum = decode('38aed7effed593e857753685e5f6a0c2092b2ebd', 'hex'); ``` ``` "id" "8661d6c6-1369-4ef9-ab63-789949ba5892" "deviceAssetId" "1000090588" "ownerId" "e1dcc5af-7ed6-452e-a703-71426f3503f2" "deviceId" "9d8c66626a310f23c6f3cbb55aaafc4f3e337a3dcb2767f83efd4e14576cf20a" "type" "IMAGE" "originalPath" "upload/library/admin/201912_TestAlbum2/20250714_143859.jpg" "fileCreatedAt" "2025-07-14 14:39:00.145+02" "fileModifiedAt" "2025-07-14 14:39:02+02" "isFavorite" false "duration" [null] "encodedVideoPath" "checksum" [binary data] "livePhotoVideoId" [null] "updatedAt" "2025-07-15 23:44:59.459927+02" "createdAt" "2025-07-15 11:17:36.99193+02" "originalFileName" "20250714_143859.jpg" "sidecarPath" [null] "thumbhash" [binary data] "isOffline" false "libraryId" [null] "isExternal" false "deletedAt" [null] "localDateTime" "2025-07-14 16:39:00.145+02" "stackId" [null] "duplicateId" [null] "status" "active" "updateId" "0198100c-5143-7977-9c5f-df69f21a018e" "visibility" "timeline" ``` Only this asset is present with that checksum also looking for this asset ID 8661d6c6-1369-4ef9-ab63-789949ba5892, it appears to be correct ``` DO $$ DECLARE rec RECORD; search_value TEXT := '8661d6c6-1369-4ef9-ab63-789949ba5892'; query TEXT; found_count INTEGER; BEGIN RAISE NOTICE 'Searching for value: %', search_value; FOR rec IN SELECT table_schema, table_name, column_name FROM information_schema.columns WHERE table_schema NOT IN ('pg_catalog', 'information_schema') AND data_type IN ('text', 'character varying', 'uuid', 'char') LOOP BEGIN query := format( 'SELECT COUNT(*) FROM %I.%I WHERE CAST(%I AS TEXT) = %L', rec.table_schema, rec.table_name, rec.column_name, search_value ); EXECUTE query INTO found_count; IF found_count > 0 THEN RAISE NOTICE 'Found "%" in %.% (Column: %, Count: %)', search_value, rec.table_schema, rec.table_name, rec.column_name, found_count; END IF; EXCEPTION WHEN OTHERS THEN RAISE WARNING 'Could not query %.% (Column: %): %', rec.table_schema, rec.table_name, rec.column_name, SQLERRM; END; END LOOP; RAISE NOTICE 'Search complete.'; END $$; ``` ``` NOTICE: Searching for value: 8661d6c6-1369-4ef9-ab63-789949ba5892 NOTICE: Found "8661d6c6-1369-4ef9-ab63-789949ba5892" in public.albums_assets_assets (Column: assetsId, Count: 1) NOTICE: Found "8661d6c6-1369-4ef9-ab63-789949ba5892" in public.asset_files (Column: assetId, Count: 2) NOTICE: Found "8661d6c6-1369-4ef9-ab63-789949ba5892" in public.asset_job_status (Column: assetId, Count: 1) NOTICE: Found "8661d6c6-1369-4ef9-ab63-789949ba5892" in public.exif (Column: assetId, Count: 1) NOTICE: Found "8661d6c6-1369-4ef9-ab63-789949ba5892" in public.smart_search (Column: assetId, Count: 1) NOTICE: Found "8661d6c6-1369-4ef9-ab63-789949ba5892" in public.assets (Column: id, Count: 1) NOTICE: Search complete. ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#6465