immich-app / immich

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

Files that are offline (deleted or missing) do not show in the trash folder. #13048

Open kidroca opened 2 months ago

kidroca commented 2 months ago

The bug

As per release notes for v1.116 for external libraries:

Files that are offline (deleted or missing) now get hidden from the timeline and will show in the trash folder.

Immich identified 6000+ files as duplicates, I downloaded the list via an API call and used it to automatically move away most of the duplicates automatically

After that I've triggered a new scan for the external library, but non of the files appear in the trash folder - it's empty. Reviewing my duplicates and opening the full image I see an "Asset Offline" warning

This external library asset is no longer found on disk and has been moved to trash. If the file was moved within the library, check your timeline for the new corresponding asset. To restore this asset, please ensure that the file path below can be accessed by Immich and scan the library.

  1. Removed assets from external library are not appearing in trash
  2. Assets are still considered for duplicate review, because there's no way to remove them from Immich

I expected to see them in trash and empty the trash to remove all

A potential workaround might be to find all the asset IDs for the stuff I moved away and use the API to delete assets by ID

The OS that Immich Server is running on

ghcr.io/immich-app/immich-server:release

Version of Immich Server

v1.116.2

Version of Immich Mobile App

v1.0.0 (unused)

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}
    extends:
      file: hwaccel.transcoding.yml
      service: cpu # set to one of [cpu, nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding
    volumes:
      # Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
      - "/mnt/fastShare/kidroca/Google_Photos_Takeout:/mnt/family/kidroca/Google_Photos_Takeout"
      - "/mnt/fastShare/kidroca/PhotoSync:/mnt/family/kidroca/PhotoSync"
      - "/mnt/d/Nadya_Google_Photos_Takeout:/mnt/family/nadeto/Google_Photos_Takeout"
      - "/mnt/fastShare/nadeto/PhotoSync:/mnt/family/nadeto/PhotoSync"
    env_file:
      - .env
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: always
    healthcheck:
      disable: false

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

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

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

volumes:
  model-cache:

Your .env content

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

# The location where your uploaded files are stored
UPLOAD_LOCATION="/mnt/immich"
# The location where your database files are stored
DB_DATA_LOCATION=./postgres

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

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

TZ=Europe/Sofia

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

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

Reproduction steps

  1. Add external library
  2. Scan external library
  3. Remove files from external library
  4. Scan external library
  5. Go to trash

Observe: offline files (indexed files now missing in ext library) are not listed in trash

Relevant log output

[Nest] 7  - 09/30/2024, 12:00:00 AM     LOG [Microservices:LibraryService] Refreshing library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for new assets
[Nest] 7  - 09/30/2024, 12:00:00 AM     LOG [Microservices:LibraryService] Refreshing library d0bdd3ea-0b53-4093-bfca-d105c646f28c for new assets
[Nest] 7  - 09/30/2024, 12:00:00 AM     LOG [Microservices:LibraryService] Scanning library d0bdd3ea-0b53-4093-bfca-d105c646f28c for removed assets
[Nest] 7  - 09/30/2024, 12:00:00 AM     LOG [Microservices:LibraryService] Scanning library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for removed assets
[Nest] 7  - 09/30/2024, 12:00:00 AM     LOG [Microservices:LibraryService] Refreshing library d0bdd3ea-0b53-4093-bfca-d105c646f28c for new assets
[Nest] 7  - 09/30/2024, 12:00:00 AM     LOG [Microservices:LibraryService] Scanning library d0bdd3ea-0b53-4093-bfca-d105c646f28c for removed assets
[Nest] 7  - 09/30/2024, 12:00:00 AM     LOG [Microservices:LibraryService] Refreshing library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for new assets
[Nest] 7  - 09/30/2024, 12:00:00 AM     LOG [Microservices:LibraryService] Scanning library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for removed assets
[Nest] 7  - 09/30/2024, 12:00:24 AM     LOG [Microservices:LibraryService] Finished queueing check of 41157 assets for library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37
[Nest] 7  - 09/30/2024, 12:00:25 AM     LOG [Microservices:LibraryService] Finished queueing check of 41157 assets for library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37
[Nest] 7  - 09/30/2024, 12:00:29 AM     LOG [Microservices:LibraryService] Finished queueing check of 79691 assets for library d0bdd3ea-0b53-4093-bfca-d105c646f28c
[Nest] 7  - 09/30/2024, 12:00:30 AM     LOG [Microservices:LibraryService] Finished queueing check of 79691 assets for library d0bdd3ea-0b53-4093-bfca-d105c646f28c
[Nest] 7  - 09/30/2024, 2:00:00 AM     LOG [Microservices:LibraryService] Refreshing library d0bdd3ea-0b53-4093-bfca-d105c646f28c for new assets
[Nest] 7  - 09/30/2024, 2:00:00 AM     LOG [Microservices:LibraryService] Refreshing library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for new assets
[Nest] 7  - 09/30/2024, 2:00:00 AM     LOG [Microservices:LibraryService] Refreshing library d0bdd3ea-0b53-4093-bfca-d105c646f28c for new assets
[Nest] 7  - 09/30/2024, 2:00:00 AM     LOG [Microservices:LibraryService] Refreshing library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for new assets
[Nest] 7  - 09/30/2024, 2:00:00 AM     LOG [Microservices:LibraryService] Scanning library d0bdd3ea-0b53-4093-bfca-d105c646f28c for removed assets
[Nest] 7  - 09/30/2024, 2:00:05 AM     LOG [Microservices:LibraryService] Scanning library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for removed assets
[Nest] 7  - 09/30/2024, 2:00:06 AM     LOG [Microservices:LibraryService] Scanning library d0bdd3ea-0b53-4093-bfca-d105c646f28c for removed assets
[Nest] 7  - 09/30/2024, 2:00:06 AM     LOG [Microservices:LibraryService] Scanning library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for removed assets
[Nest] 7  - 09/30/2024, 2:00:25 AM     LOG [Microservices:LibraryService] Finished queueing check of 41157 assets for library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37
[Nest] 7  - 09/30/2024, 2:00:25 AM     LOG [Microservices:LibraryService] Finished queueing check of 41157 assets for library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37
[Nest] 7  - 09/30/2024, 2:00:30 AM     LOG [Microservices:LibraryService] Finished queueing check of 79691 assets for library d0bdd3ea-0b53-4093-bfca-d105c646f28c
[Nest] 7  - 09/30/2024, 2:00:30 AM     LOG [Microservices:LibraryService] Finished queueing check of 79691 assets for library d0bdd3ea-0b53-4093-bfca-d105c646f28c
[Nest] 7  - 09/30/2024, 4:00:00 AM     LOG [Microservices:LibraryService] Refreshing library d0bdd3ea-0b53-4093-bfca-d105c646f28c for new assets
[Nest] 7  - 09/30/2024, 4:00:00 AM     LOG [Microservices:LibraryService] Refreshing library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for new assets
[Nest] 7  - 09/30/2024, 4:00:00 AM     LOG [Microservices:LibraryService] Refreshing library d0bdd3ea-0b53-4093-bfca-d105c646f28c for new assets
[Nest] 7  - 09/30/2024, 4:00:00 AM     LOG [Microservices:LibraryService] Refreshing library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for new assets
[Nest] 7  - 09/30/2024, 4:00:00 AM     LOG [Microservices:LibraryService] Scanning library d0bdd3ea-0b53-4093-bfca-d105c646f28c for removed assets
[Nest] 7  - 09/30/2024, 4:00:05 AM     LOG [Microservices:LibraryService] Scanning library d0bdd3ea-0b53-4093-bfca-d105c646f28c for removed assets
[Nest] 7  - 09/30/2024, 4:00:05 AM     LOG [Microservices:LibraryService] Scanning library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for removed assets
[Nest] 7  - 09/30/2024, 4:00:06 AM     LOG [Microservices:LibraryService] Scanning library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for removed assets
[Nest] 7  - 09/30/2024, 4:00:24 AM     LOG [Microservices:LibraryService] Finished queueing check of 41157 assets for library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37
[Nest] 7  - 09/30/2024, 4:00:25 AM     LOG [Microservices:LibraryService] Finished queueing check of 41157 assets for library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37
[Nest] 7  - 09/30/2024, 4:00:29 AM     LOG [Microservices:LibraryService] Finished queueing check of 79691 assets for library d0bdd3ea-0b53-4093-bfca-d105c646f28c
[Nest] 7  - 09/30/2024, 4:00:30 AM     LOG [Microservices:LibraryService] Finished queueing check of 79691 assets for library d0bdd3ea-0b53-4093-bfca-d105c646f28c
[Nest] 7  - 09/30/2024, 4:02:37 AM     LOG [Microservices:LibraryService] Importing new library asset: /mnt/family/nadeto/PhotoSync/2024/09/IMG_9007.PNG
[Nest] 7  - 09/30/2024, 4:02:37 AM    WARN [Microservices:MetadataService] Asset 220e045c-4051-4043-b346-b3a3a8c9ef78 has no time zone information
[Nest] 7  - 09/30/2024, 4:02:38 AM     LOG [Microservices:MediaService] Successfully generated WEBP image preview for asset /mnt/family/nadeto/PhotoSync/2024/09/IMG_9007.PNG
[Nest] 7  - 09/30/2024, 4:02:38 AM     LOG [Microservices:MediaService] Successfully generated WEBP image thumbnail for asset /mnt/family/nadeto/PhotoSync/2024/09/IMG_9007.PNG
[Nest] 7  - 09/30/2024, 6:00:00 AM     LOG [Microservices:LibraryService] Refreshing library d0bdd3ea-0b53-4093-bfca-d105c646f28c for new assets
[Nest] 7  - 09/30/2024, 6:00:00 AM     LOG [Microservices:LibraryService] Refreshing library d0bdd3ea-0b53-4093-bfca-d105c646f28c for new assets
[Nest] 7  - 09/30/2024, 6:00:00 AM     LOG [Microservices:LibraryService] Refreshing library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for new assets
[Nest] 7  - 09/30/2024, 6:00:00 AM     LOG [Microservices:LibraryService] Refreshing library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for new assets
[Nest] 7  - 09/30/2024, 6:00:00 AM     LOG [Microservices:LibraryService] Scanning library d0bdd3ea-0b53-4093-bfca-d105c646f28c for removed assets
[Nest] 7  - 09/30/2024, 6:00:00 AM     LOG [Microservices:LibraryService] Scanning library d0bdd3ea-0b53-4093-bfca-d105c646f28c for removed assets
[Nest] 7  - 09/30/2024, 6:00:00 AM     LOG [Microservices:LibraryService] Scanning library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for removed assets
[Nest] 7  - 09/30/2024, 6:00:00 AM     LOG [Microservices:LibraryService] Scanning library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for removed assets
[Nest] 7  - 09/30/2024, 6:00:24 AM     LOG [Microservices:LibraryService] Finished queueing check of 41157 assets for library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37
[Nest] 7  - 09/30/2024, 6:00:25 AM     LOG [Microservices:LibraryService] Finished queueing check of 41157 assets for library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37
[Nest] 7  - 09/30/2024, 6:00:30 AM     LOG [Microservices:LibraryService] Finished queueing check of 79692 assets for library d0bdd3ea-0b53-4093-bfca-d105c646f28c
[Nest] 7  - 09/30/2024, 6:00:31 AM     LOG [Microservices:LibraryService] Finished queueing check of 79692 assets for library d0bdd3ea-0b53-4093-bfca-d105c646f28c
[Nest] 7  - 09/30/2024, 8:00:00 AM     LOG [Microservices:LibraryService] Refreshing library d0bdd3ea-0b53-4093-bfca-d105c646f28c for new assets
[Nest] 7  - 09/30/2024, 8:00:00 AM     LOG [Microservices:LibraryService] Refreshing library d0bdd3ea-0b53-4093-bfca-d105c646f28c for new assets
[Nest] 7  - 09/30/2024, 8:00:00 AM     LOG [Microservices:LibraryService] Refreshing library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for new assets
[Nest] 7  - 09/30/2024, 8:00:00 AM     LOG [Microservices:LibraryService] Scanning library d0bdd3ea-0b53-4093-bfca-d105c646f28c for removed assets
[Nest] 7  - 09/30/2024, 8:00:00 AM     LOG [Microservices:LibraryService] Refreshing library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for new assets
[Nest] 7  - 09/30/2024, 8:00:00 AM     LOG [Microservices:LibraryService] Scanning library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for removed assets
[Nest] 7  - 09/30/2024, 8:00:05 AM     LOG [Microservices:LibraryService] Scanning library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for removed assets
[Nest] 7  - 09/30/2024, 8:00:05 AM     LOG [Microservices:LibraryService] Scanning library d0bdd3ea-0b53-4093-bfca-d105c646f28c for removed assets
[Nest] 7  - 09/30/2024, 8:00:24 AM     LOG [Microservices:LibraryService] Finished queueing check of 41157 assets for library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37
[Nest] 7  - 09/30/2024, 8:00:25 AM     LOG [Microservices:LibraryService] Finished queueing check of 41157 assets for library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37
[Nest] 7  - 09/30/2024, 8:00:30 AM     LOG [Microservices:LibraryService] Finished queueing check of 79692 assets for library d0bdd3ea-0b53-4093-bfca-d105c646f28c
[Nest] 7  - 09/30/2024, 8:00:30 AM     LOG [Microservices:LibraryService] Finished queueing check of 79692 assets for library d0bdd3ea-0b53-4093-bfca-d105c646f28c
[Nest] 7  - 09/30/2024, 10:00:00 AM     LOG [Microservices:LibraryService] Refreshing library d0bdd3ea-0b53-4093-bfca-d105c646f28c for new assets
[Nest] 7  - 09/30/2024, 10:00:00 AM     LOG [Microservices:LibraryService] Refreshing library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for new assets
[Nest] 7  - 09/30/2024, 10:00:00 AM     LOG [Microservices:LibraryService] Refreshing library d0bdd3ea-0b53-4093-bfca-d105c646f28c for new assets
[Nest] 7  - 09/30/2024, 10:00:00 AM     LOG [Microservices:LibraryService] Refreshing library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for new assets
[Nest] 7  - 09/30/2024, 10:00:00 AM     LOG [Microservices:LibraryService] Scanning library d0bdd3ea-0b53-4093-bfca-d105c646f28c for removed assets
[Nest] 7  - 09/30/2024, 10:00:00 AM     LOG [Microservices:LibraryService] Scanning library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for removed assets
[Nest] 7  - 09/30/2024, 10:00:03 AM     LOG [Microservices:LibraryService] Scanning library d0bdd3ea-0b53-4093-bfca-d105c646f28c for removed assets
[Nest] 7  - 09/30/2024, 10:00:05 AM     LOG [Microservices:LibraryService] Scanning library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37 for removed assets
[Nest] 7  - 09/30/2024, 10:00:26 AM     LOG [Microservices:LibraryService] Finished queueing check of 41157 assets for library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37
[Nest] 7  - 09/30/2024, 10:00:26 AM     LOG [Microservices:LibraryService] Finished queueing check of 41157 assets for library 072fe9b3-c7eb-4551-b6ee-6d71898d2f37
[Nest] 7  - 09/30/2024, 10:00:32 AM     LOG [Microservices:LibraryService] Finished queueing check of 79692 assets for library d0bdd3ea-0b53-4093-bfca-d105c646f28c
[Nest] 7  - 09/30/2024, 10:00:32 AM     LOG [Microservices:LibraryService] Finished queueing check of 79692 assets for library d0bdd3ea-0b53-4093-bfca-d105c646f28c

Additional information

No response

alextran1502 commented 2 months ago

@kidroca Can this be reproducible with a single external library?

@zackpollard, Can you help take a look at this issue? Thank you

zackpollard commented 2 months ago

I tried moving files around and renaming them (to create a new file and offline the old path) and they always end up in trash for me

kidroca commented 2 months ago

@alextran1502

@kidroca Can this be reproducible with a single external library?

I've added all paths under the same external library, so any duplicates can be detected:

      - "/mnt/fastShare/kidroca/Google_Photos_Takeout:/mnt/family/kidroca/Google_Photos_Takeout"
      - "/mnt/fastShare/kidroca/PhotoSync:/mnt/family/kidroca/PhotoSync"
      - "/mnt/d/Nadya_Google_Photos_Takeout:/mnt/family/nadeto/Google_Photos_Takeout"
      - "/mnt/fastShare/nadeto/PhotoSync:/mnt/family/nadeto/PhotoSync"

But originally, the paths below were added to a separate external library

      - "/mnt/d/Nadya_Google_Photos_Takeout:/mnt/family/nadeto/Google_Photos_Takeout"
      - "/mnt/fastShare/nadeto/PhotoSync:/mnt/family/nadeto/PhotoSync"

Initially I created 2 external libraries, but later realized that this won't detect duplicates across different external libraries

I didn't want to lose all indexing / thumbnails / face recognition of the 2nd external library, so I didn't remove it.

Now I have one external library that contains everything and a 2nd external library, that contains a subset.

I guess I should have started with a single library and split into 2 only after sorting out the duplicates

In any case I've removed about 6000 files flagged as duplicates by Immich. Reviewing individual files via the duplicates utility confirms they are offline, but the /trash view is empty

kidroca commented 2 months ago

I've just removed a bunch of videos outside of Immich and rescanned libraries and the removed videos do appear in the trash

I don't think these videos were flagged as duplicates by Immich, could this be the problem?

The assets flagged as duplicates don't appear in trash, because they are flagged as duplicates and somehow this takes priority over listing them in trash?