iOS Backup stuck on group of images #3545

Closed
opened 2026-02-05 08:54:38 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @RichFoley on GitHub (Jun 16, 2024).

The bug

While trying to sync iOS library, the backup gets stuck on an image. There appears to be a group of images from ~2015 that will not upload. I can delete the image from my iOS photo roll and backup will restart and get stuck on the next image in the series.

Example: it will get stuck on img_0001.jpg > delete img_0001.jpg > gets stuck on img_0002.jpg.

There are no errors in the mobile log, but it appears to be syncing changes of albums that are not selected (I have Recents and two others selected):
image

Backup screen:
image

I've found errors in the server log about a unique key constraint violation, but it appears to happen before the app gets stuck, so I'm not sure if this is related:
immich.log

Please let me know what I can do to help investigate. Not sure where to go from here.

The OS that Immich Server is running on

docker compose

Version of Immich Server

1.106.4

Version of Immich Mobile App

1.106.3 build.160

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

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:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: always

  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}-cuda
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities:
                - gpu
    # 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

  redis:
    container_name: immich_redis
    image: docker.io/redis:6.2-alpine@sha256:d6c2911ac51b289db208767581a5d154544f2b2fe4914ea5056443f62dc6e900
    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:
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
    healthcheck:
      test: pg_isready --dbname='${DB_DATABASE_NAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no->      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_>
    restart: always

  tunnel:
    image: cloudflare/cloudflared:latest
    command: tunnel --no-autoupdate run --token ${cftoken}    restart: always
    container_name: immich_tunnel
    depends_on:
      - immich-server

volumes:
  model-cache:

Your .env content

UPLOAD_LOCATION=/the_quad/immich
DB_DATA_LOCATION=./postgres
TZ=America/New_York

IMMICH_VERSION=release

DB_PASSWORD=1234-(jk)

DB_USERNAME=postgres
DB_DATABASE_NAME=immich

Reproduction steps

1. sync iOS photos (I assume it's something specific to my files)

Relevant log output

immich_server            | [Nest] 17  - 06/16/2024, 9:08:19 AM   ERROR [Api:AssetMediaService~0oqf2fi4] Error uploading file QueryFailedError: duplicate key value violates unique constraint "UQ_16294b83fa8c0149719a1f631ef"
immich_server            | QueryFailedError: duplicate key value violates unique constraint "UQ_16294b83fa8c0149719a1f631ef"
immich_server            |     at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
immich_server            |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich_server            |     at async InsertQueryBuilder.execute (/usr/src/app/node_modules/typeorm/query-builder/InsertQueryBuilder.js:106:33)
immich_server            |     at async SubjectExecutor.executeInsertOperations (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:260:42)
immich_server            |     at async SubjectExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:92:9)
immich_server            |     at async EntityPersistExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/EntityPersistExecutor.js:140:21)
immich_server            |     at async AssetMediaService.create (/usr/src/app/dist/services/asset-media.service.js:290:23)
immich_server            |     at async AssetMediaService.uploadAsset (/usr/src/app/dist/services/asset-media.service.js:131:27)
immich_server            |     at async AssetMediaController.uploadAsset (/usr/src/app/dist/controllers/asset-media.controller.js:39:29)
immich_server            | [Nest] 17  - 06/16/2024, 9:08:19 AM   ERROR [Api:QueryFailedError: duplicate key value violates unique constraint "UQ_16294b83fa8c0149719a1f631ef"
immich_server            |     at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
immich_server            |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich_server            |     at async InsertQueryBuilder.execute (/usr/src/app/node_modules/typeorm/query-builder/InsertQueryBuilder.js:106:33)
immich_server            |     at async SubjectExecutor.executeInsertOperations (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:260:42)
immich_server            |     at async SubjectExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:92:9)
immich_server            |     at async EntityPersistExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/EntityPersistExecutor.js:140:21)
immich_server            |     at async AssetMediaService.create (/usr/src/app/dist/services/asset-media.service.js:290:23)
immich_server            |     at async AssetMediaService.uploadAsset (/usr/src/app/dist/services/asset-media.service.js:131:27)
immich_server            |     at async AssetMediaController.uploadAsset (/usr/src/app/dist/controllers/asset-media.controller.js:39:29)~0oqf2fi4] Failed to upload asset
immich_server            | [Nest] 17  - 06/16/2024, 9:08:19 AM   ERROR [Api:QueryFailedError: duplicate key value violates unique constraint "UQ_16294b83fa8c0149719a1f631ef"
immich_server            |     at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
immich_server            |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
immich_server            |     at async InsertQueryBuilder.execute (/usr/src/app/node_modules/typeorm/query-builder/InsertQueryBuilder.js:106:33)
immich_server            |     at async SubjectExecutor.executeInsertOperations (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:260:42)
immich_server            |     at async SubjectExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:92:9)
immich_server            |     at async EntityPersistExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/EntityPersistExecutor.js:140:21)
immich_server            |     at async AssetMediaService.create (/usr/src/app/dist/services/asset-media.service.js:290:23)
immich_server            |     at async AssetMediaService.uploadAsset (/usr/src/app/dist/services/asset-media.service.js:131:27)
immich_server            |     at async AssetMediaController.uploadAsset (/usr/src/app/dist/controllers/asset-media.controller.js:39:29)~0oqf2fi4] QueryFailedError: duplicate key value violates unique constraint "UQ_16294b83fa8c0149719a1f631ef"

Additional information

No response

Originally created by @RichFoley on GitHub (Jun 16, 2024). ### The bug While trying to sync iOS library, the backup gets stuck on an image. There appears to be a group of images from ~2015 that will not upload. I can delete the image from my iOS photo roll and backup will restart and get stuck on the next image in the series. Example: it will get stuck on img_0001.jpg > delete img_0001.jpg > gets stuck on img_0002.jpg. There are no errors in the mobile log, but it appears to be syncing changes of albums that are not selected (I have Recents and two others selected): ![image](https://github.com/immich-app/immich/assets/6298485/1792cba6-68a2-4738-9479-9e5f17e05924) Backup screen: ![image](https://github.com/immich-app/immich/assets/6298485/b0dc84f4-3ce8-4b2c-abc8-97e18204d1af) I've found errors in the server log about a unique key constraint violation, but it appears to happen before the app gets stuck, so I'm not sure if this is related: [immich.log](https://github.com/user-attachments/files/15858162/immich.log) Please let me know what I can do to help investigate. Not sure where to go from here. ### The OS that Immich Server is running on docker compose ### Version of Immich Server 1.106.4 ### Version of Immich Mobile App 1.106.3 build.160 ### Platform with the issue - [X] Server - [ ] Web - [X] Mobile ### Your docker-compose.yml content ```YAML 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: - ${UPLOAD_LOCATION}:/usr/src/app/upload - /etc/localtime:/etc/localtime:ro env_file: - .env ports: - 2283:3001 depends_on: - redis - database restart: always 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}-cuda deploy: resources: reservations: devices: - driver: nvidia count: 1 capabilities: - gpu # 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 redis: container_name: immich_redis image: docker.io/redis:6.2-alpine@sha256:d6c2911ac51b289db208767581a5d154544f2b2fe4914ea5056443f62dc6e900 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: - ${DB_DATA_LOCATION}:/var/lib/postgresql/data healthcheck: test: pg_isready --dbname='${DB_DATABASE_NAME}' || exit 1; Chksum="$$(psql --dbname='${DB_DATABASE_NAME}' --username='${DB_USERNAME}' --tuples-only --no-> 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_> restart: always tunnel: image: cloudflare/cloudflared:latest command: tunnel --no-autoupdate run --token ${cftoken} restart: always container_name: immich_tunnel depends_on: - immich-server volumes: model-cache: ``` ### Your .env content ```Shell UPLOAD_LOCATION=/the_quad/immich DB_DATA_LOCATION=./postgres TZ=America/New_York IMMICH_VERSION=release DB_PASSWORD=1234-(jk) DB_USERNAME=postgres DB_DATABASE_NAME=immich ``` ### Reproduction steps ```bash 1. sync iOS photos (I assume it's something specific to my files) ``` ### Relevant log output ```shell immich_server | [Nest] 17 - 06/16/2024, 9:08:19 AM ERROR [Api:AssetMediaService~0oqf2fi4] Error uploading file QueryFailedError: duplicate key value violates unique constraint "UQ_16294b83fa8c0149719a1f631ef" immich_server | QueryFailedError: duplicate key value violates unique constraint "UQ_16294b83fa8c0149719a1f631ef" immich_server | at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19) immich_server | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) immich_server | at async InsertQueryBuilder.execute (/usr/src/app/node_modules/typeorm/query-builder/InsertQueryBuilder.js:106:33) immich_server | at async SubjectExecutor.executeInsertOperations (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:260:42) immich_server | at async SubjectExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:92:9) immich_server | at async EntityPersistExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/EntityPersistExecutor.js:140:21) immich_server | at async AssetMediaService.create (/usr/src/app/dist/services/asset-media.service.js:290:23) immich_server | at async AssetMediaService.uploadAsset (/usr/src/app/dist/services/asset-media.service.js:131:27) immich_server | at async AssetMediaController.uploadAsset (/usr/src/app/dist/controllers/asset-media.controller.js:39:29) immich_server | [Nest] 17 - 06/16/2024, 9:08:19 AM ERROR [Api:QueryFailedError: duplicate key value violates unique constraint "UQ_16294b83fa8c0149719a1f631ef" immich_server | at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19) immich_server | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) immich_server | at async InsertQueryBuilder.execute (/usr/src/app/node_modules/typeorm/query-builder/InsertQueryBuilder.js:106:33) immich_server | at async SubjectExecutor.executeInsertOperations (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:260:42) immich_server | at async SubjectExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:92:9) immich_server | at async EntityPersistExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/EntityPersistExecutor.js:140:21) immich_server | at async AssetMediaService.create (/usr/src/app/dist/services/asset-media.service.js:290:23) immich_server | at async AssetMediaService.uploadAsset (/usr/src/app/dist/services/asset-media.service.js:131:27) immich_server | at async AssetMediaController.uploadAsset (/usr/src/app/dist/controllers/asset-media.controller.js:39:29)~0oqf2fi4] Failed to upload asset immich_server | [Nest] 17 - 06/16/2024, 9:08:19 AM ERROR [Api:QueryFailedError: duplicate key value violates unique constraint "UQ_16294b83fa8c0149719a1f631ef" immich_server | at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19) immich_server | at process.processTicksAndRejections (node:internal/process/task_queues:95:5) immich_server | at async InsertQueryBuilder.execute (/usr/src/app/node_modules/typeorm/query-builder/InsertQueryBuilder.js:106:33) immich_server | at async SubjectExecutor.executeInsertOperations (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:260:42) immich_server | at async SubjectExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/SubjectExecutor.js:92:9) immich_server | at async EntityPersistExecutor.execute (/usr/src/app/node_modules/typeorm/persistence/EntityPersistExecutor.js:140:21) immich_server | at async AssetMediaService.create (/usr/src/app/dist/services/asset-media.service.js:290:23) immich_server | at async AssetMediaService.uploadAsset (/usr/src/app/dist/services/asset-media.service.js:131:27) immich_server | at async AssetMediaController.uploadAsset (/usr/src/app/dist/controllers/asset-media.controller.js:39:29)~0oqf2fi4] QueryFailedError: duplicate key value violates unique constraint "UQ_16294b83fa8c0149719a1f631ef" ``` ### Additional information _No response_
Author
Owner

@alextremblay commented on GitHub (Jun 19, 2024):

I'm having a similar (same?) issue:

same behaviour and error message on server, same server version and deployment model

the only difference is that i'm running ios client v1.106.4 rather than v1.106.3, and in client logs I'm seeing "Failed to hash file ..." warnings for all of these images that fail to upload

Immich_log_2024-06-19T09:59:46.028639.log

@alextremblay commented on GitHub (Jun 19, 2024): I'm having a similar (same?) issue: same behaviour and error message on server, same server version and deployment model the only difference is that i'm running ios client v1.106.4 rather than v1.106.3, and in client logs I'm seeing "Failed to hash file ..." warnings for all of these images that fail to upload [Immich_log_2024-06-19T09:59:46.028639.log](https://github.com/user-attachments/files/15902005/Immich_log_2024-06-19T09.59.46.028639.log)
Author
Owner

@alextremblay commented on GitHub (Jul 2, 2024):

Update: running v1.107.0 on client and server, issue resolved itself

I don't see anything in the changelog directly related to this, so I'm not sure how the issue resolved itself, but I'me happy to see that it did 😄

@alextremblay commented on GitHub (Jul 2, 2024): Update: running v1.107.0 on client and server, issue resolved itself I don't see anything in the changelog directly related to this, so I'm not sure how the issue resolved itself, but I'me happy to see that it did 😄
Author
Owner

@RichFoley commented on GitHub (Aug 18, 2024):

Same here, issue has been resolved!

@RichFoley commented on GitHub (Aug 18, 2024): Same here, issue has been resolved!
Author
Owner

@seb26 commented on GitHub (Aug 20, 2024):

There are a few threads floating around for iOS backup getting stuck on particular images and then the app not skipping that image, instead just never progressing.

I did find a solve for my own case though which I'll share.

The file was an .EXR image file I airdropped to my phone at some point. I can't for the life of me locate it in my Photos.app to try and delete it.

But when Immich iOS app encounters this file, it sits there stuck at either 0% or 4% uploading and it does not move past this file.

Server: 1.112.1 (HTTP direct, no TLS or forwarding)
Server log:

immich_server            | [Nest] 17  - 08/20/2024, 12:52:49 PM
ERROR [Api:AssetMediaService~d5a58hwq] Unsupported file type syntheticChart.01_LogC_EI800_AWG.exr

Client: iOS 17.5.1, Immich 1.112.1 build.169
Client log:
Nothing. It never appears as an entry.

I actually have a few entries in the Server log last few hours for this same file. So it seems at different moments, the app was able to move past this file. But at this time it was stuck.

Then, I went into Immich iOS app > my user icon > Settings > Advanced and switched on [x] Troubleshooting and changed Log Level from INFO to FINE.

Immediately, the Backup job tried one more time to upload the EXR file, stopped, and showed a Failed (1) little tag and a window with details and a thumbnail of the file. It flew rapidly through the remaining files! Great!

I am not certain which change I made influenced the behaviour at this moment. It was most likely Troubleshooting mode ON.

I suggest that to anyone else encountering this phenomenon.

Thank you Immich devs for such a fantastic program. Honestly feels like such a steal to have this incredible platform for free. I hope to contribute at some point.

@seb26 commented on GitHub (Aug 20, 2024): There are a few threads floating around for iOS backup getting stuck on particular images and then the app not skipping that image, instead just never progressing. I did find a solve for my own case though which I'll share. The file was an .EXR image file I airdropped to my phone at some point. I can't for the life of me locate it in my Photos.app to try and delete it. But when Immich iOS app encounters this file, it sits there stuck at either 0% or 4% uploading and it does not move past this file. Server: 1.112.1 (HTTP direct, no TLS or forwarding) Server log: ``` immich_server | [Nest] 17 - 08/20/2024, 12:52:49 PM ERROR [Api:AssetMediaService~d5a58hwq] Unsupported file type syntheticChart.01_LogC_EI800_AWG.exr ``` Client: iOS 17.5.1, Immich 1.112.1 build.169 Client log: Nothing. It never appears as an entry. I actually have a few entries in the Server log last few hours for this same file. So it seems at different moments, the app was able to move past this file. But at this time it was stuck. Then, I went into Immich iOS app > my user icon > Settings > Advanced and switched on [x] Troubleshooting and changed Log Level from INFO to FINE. Immediately, the Backup job tried one more time to upload the EXR file, stopped, and showed a `Failed (1)` little tag and a window with details and a thumbnail of the file. It flew rapidly through the remaining files! Great! I am not certain which change I made influenced the behaviour at this moment. It was most likely Troubleshooting mode ON. I suggest that to anyone else encountering this phenomenon. Thank you Immich devs for such a fantastic program. Honestly feels like such a steal to have this incredible platform for free. I hope to contribute at some point.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#3545