immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
50.03k stars 2.65k forks source link

[Bug] Can't view images in app after deleting local copy using external app #9249

Open stephen304 opened 6 months ago

stephen304 commented 6 months ago

The bug

I noticed that Google Photos started backing up my photos again (I must have accidentally pressed one of the nag screens when going to edit an image), so I deleted everything from the Photos tab in Google Photos to remove them from my account. This seems to have also removed the photos from my phone, which is fine - because I keep everything backed up in Immich.

The problem is that Immich doesn't seem to realize that I deleted the local copy for everything that had a local + cloud copy:

There are also 2 additional failure modes once the main failure mode is triggered (deleted locally, app thinks it's cloud+local when it's actually cloud only, image fails to display):

  1. Deleting the image + empty trash on desktop results in the app still thinking the image is cloud+local when it doesn't exist on the server or locally at all. None of the 3 delete options work (delete/delete local/move to trash do nothing)
  2. Deleting the bugged image in app and emptying trash in the app results in the image showing back up in the timeline - since the app sent the deletion request to the server, presumably this is why the app knows there's no cloud copy anymore, so the cloud icon is crossed out and the image also does not exist on the server or locally but like case 1 the image doesn't exist in either place. Since the app knows there's no cloud version, only delete from device is available, but neither options in the "Delete Permanently" popup do anything (delete backed up only / delete anyway)

The OS that Immich Server is running on

Synology

Version of Immich Server

v1.103.1

Version of Immich Mobile App

1.103.1 build.137

Platform with the issue

Your docker-compose.yml content

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

name: immich

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: [ "start.sh", "immich" ]
    restart: unless-stopped
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
#    ports:
#      - 2283:3001
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.immich.rule=Host(`xxxxxxxxxx`)"
      - "traefik.http.routers.immich.entrypoints=websecure"
      - "traefik.http.routers.immich.tls.certresolver=mytlschallenge"
      - "traefik.http.services.immich.loadbalancer.server.port=3001"
    networks:
      - default
      - ingress
    depends_on:
      - redis
      - database

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/hardware-transcoding
    #   file: hwaccel.transcoding.yml
    #   service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    command: [ "start.sh", "microservices" ]
    restart: unless-stopped
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database

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

  redis:
    container_name: immich_redis
    image: registry.hub.docker.com/library/redis:6.2-alpine@sha256:51d6c56749a4243096327e3fb964a48ed92254357108449cb6e23999c37773c5
    restart: unless-stopped

  database:
    container_name: immich_postgres
    image: registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    restart: unless-stopped
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data

networks:
  ingress:
    external: true

Your .env content

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

# The location where your uploaded files are stored
UPLOAD_LOCATION=./volumes/library
# The location where your database files are stored
DB_DATA_LOCATION=./volumes/postgres

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

# Connection secret for postgres. You should change it to a random password
DB_PASSWORD=xxxxxxxxx

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

REDIS_HOSTNAME=immich_redis

Reproduction steps

Main failure mode:
1. Back up photos in Immich app
2. Delete photo from device in Google Photos
3. Open Immich and try to view photos

Result: Image not viewable in app, cannot delete or delete from device

Additional error state:
4. Delete and empty trash on desktop

Result: Image not viewable or deletable in app, delete/delete from device does nothing, move to trash closes long-press menu but image stays in timeline, image shows cloud+check icon but does not exist on device or on web

Alternate error state:
4. (alternate) Delete and empty trash on mobile

Result: Image not viewable in app, only "delete from device" available which gives a popup that says "some items aren't backed up and will be permanently removed", it offers options "delete backed up only" and "delete anyway", both options close the popup and do nothing

Relevant log output

n/a

Additional information

Timeline view of main case: Screenshot_20240503-163553_Immich

After clicking into one of the images: Screenshot_20240503-164704_Immich

The info of an image, the location bubble shows the image that still exists on the server: Screenshot_20240503-164719_Immich

Video of reproduction:

https://github.com/immich-app/immich/assets/981915/c29ba4c0-b914-4f8d-b52d-eb04cb144d50

Video of trying to delete/delete local before doing move to trash:

https://github.com/immich-app/immich/assets/981915/672a0356-a6fe-4bfe-adc2-c8ab19124d18

Screenshots of bonus failure case # 2, bugged image deleted and empty-trashed in app, delete buttons no longer do anything: Screenshot_20240503-181652_Immich Screenshot_20240503-181649_Immich

jrasm91 commented 6 months ago

Thank you for the detailed report!

MatthiasJonen commented 2 months ago

I have the same problem. iOS device. Enabling this Setting image solves the issue for pictures for me. Video thumbnails are shown now as well but won't play. I hope this information helps somewhat

gschintgen commented 2 months ago

Seems to be a duplicate of #5221 ?