Empty Trash / Restore All not working #3787

Closed
opened 2026-02-05 09:14:37 +03:00 by OVERLORD · 8 comments
Owner

Originally created by @bpbradley on GitHub (Jul 2, 2024).

The bug

Since at least 1.106 I am noticing that Empty Trash / Restore all is not working. After a large duplicate deletion process, I used the empty trash button, and it claimed to have deleted all of the assets. I then refresh the page, and see that they are all still there. Similarly, I tried restoring all and again when I refresh they are all still there.

If I individually delete every file, it works fine. I first thought it was because I had read only mounts and some files were read only, but these delete fine from immich if I individually delete them (it gives a warning in the log). I then deleted some test files that were not part of read only external libraries, and the problem exists with those as well. I had to manually delete every file in the trash in order to empty it.

The OS that Immich Server is running on

Debian 13 (Bookworm)

Version of Immich Server

v1.107.0

Version of Immich Mobile App

v1.107.1

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}
    devices:
      - /dev/dri:/dev/dri
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload/upload
      - ${THUMB_LOCATION}:/usr/src/app/upload/thumbs
      - ${ENCODED_VIDEO_LOCATION}:/usr/src/app/upload/encoded-video
      - ${PROFILE_LOCATION}:/usr/src/app/upload/profile
      - ${LIBRARY_LOCATION}:/usr/src/app/upload/library
      - ${EXTERNAL_LOCATION}:/libraries:ro
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - 10230:3001
    networks:
      - proxy
    depends_on:
      - redis
      - database
    restart: always
    labels:
      - traefik.enable=true
      - traefik.docker.network=proxy
      - traefik.http.routers.immich.entrypoints=http
      - traefik.http.routers.immich.rule=Host(`${SERVICE_HOSTNAME}`)
      - traefik.http.middlewares.immich-https-redirect.redirectscheme.scheme=https
      - traefik.http.routers.immich.middlewares=immich-https-redirect
      - traefik.http.routers.immich-secure.entrypoints=https
      - traefik.http.routers.immich-secure.rule=Host(`${SERVICE_HOSTNAME}`)
      - traefik.http.routers.immich-secure.middlewares=secured-noauth@file
      - traefik.http.routers.immich-secure.tls=true
      - traefik.http.routers.immich-secure.service=immich
      - traefik.http.services.immich.loadbalancer.server.port=3001
      - com.centurylinklabs.watchtower.enable=true
      - com.centurylinklabs.watchtower.monitor-only=true
  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
    networks:
      - proxy
    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
    networks:
      - proxy
  database:
    container_name: immich_postgres
    image: docker.io/tensorchord/pgvecto-rs:pg15-v0.2.0@sha256:d9847b0db25f3f00c6910e7b1e34085717f74f01da5f5a8cb7cdfe8d0267058b
    networks:
      - proxy
    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-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
  backup:
    container_name: immich_db_backup
    image: prodrigestivill/postgres-backup-local:15
    restart: always
    env_file:
      - .env
    networks:
      - proxy
    environment:
      POSTGRES_HOST: database
      POSTGRES_CLUSTER: "TRUE"
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      SCHEDULE: 0 5 4 * * *
      POSTGRES_EXTRA_OPTS: --clean --if-exists
      BACKUP_DIR: /db_dumps
      BACKUP_KEEP_DAYS: 7
      BACKUP_KEEP_WEEKS: 4
      BACKUP_KEEP_MONTHS: 2
      WEBHOOK_URL: ${DB_BACKUP_WEBHOOK_URL}
    volumes:
      - /mnt/data/immich/db_backups:/db_dumps
      - /mnt/data/db-backup/00-kuma-webhoo.sh:/hooks/00-webhook
    labels:
      - com.centurylinklabs.watchtower.enable=true
      - com.centurylinklabs.watchtower.monitor-only=true
    depends_on:
      - database
volumes:
  model-cache: null
networks:
  proxy:
    external: true

Your .env content

LIBRARY_LOCATION=/mnt/photos/immich
EXTERNAL_LOCATION=/mnt/photos/lib
UPLOAD_LOCATION=/mnt/data/immich/uploads
THUMB_LOCATION=/mnt/data/immich/thumbs
ENCODED_VIDEO_LOCATION=/mnt/data/immich/encoded
PROFILE_LOCATION=/mnt/data/immich/profile
# The location where your database files are stored
DB_DATA_LOCATION=/mnt/data/immich/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=

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

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

REDIS_HOSTNAME=immich_redis
DB_BACKUP_WEBHOOK_URL=

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

Reproduction steps

1. Delete some files
2. Try to Remove all / restore all 
3. Note that it claims to have done so
4. Refresh page
5. See that the files are still there in the trash

Relevant log output

No response

Additional information

No response

Originally created by @bpbradley on GitHub (Jul 2, 2024). ### The bug Since at least 1.106 I am noticing that Empty Trash / Restore all is not working. After a large duplicate deletion process, I used the empty trash button, and it claimed to have deleted all of the assets. I then refresh the page, and see that they are all still there. Similarly, I tried restoring all and again when I refresh they are all still there. If I individually delete every file, it works fine. I first thought it was because I had read only mounts and some files were read only, but these delete fine from immich if I individually delete them (it gives a warning in the log). I then deleted some test files that were not part of read only external libraries, and the problem exists with those as well. I had to manually delete every file in the trash in order to empty it. ### The OS that Immich Server is running on Debian 13 (Bookworm) ### Version of Immich Server v1.107.0 ### Version of Immich Mobile App v1.107.1 ### Platform with the issue - [X] Server - [ ] Web - [ ] 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} devices: - /dev/dri:/dev/dri volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload/upload - ${THUMB_LOCATION}:/usr/src/app/upload/thumbs - ${ENCODED_VIDEO_LOCATION}:/usr/src/app/upload/encoded-video - ${PROFILE_LOCATION}:/usr/src/app/upload/profile - ${LIBRARY_LOCATION}:/usr/src/app/upload/library - ${EXTERNAL_LOCATION}:/libraries:ro - /etc/localtime:/etc/localtime:ro env_file: - .env ports: - 10230:3001 networks: - proxy depends_on: - redis - database restart: always labels: - traefik.enable=true - traefik.docker.network=proxy - traefik.http.routers.immich.entrypoints=http - traefik.http.routers.immich.rule=Host(`${SERVICE_HOSTNAME}`) - traefik.http.middlewares.immich-https-redirect.redirectscheme.scheme=https - traefik.http.routers.immich.middlewares=immich-https-redirect - traefik.http.routers.immich-secure.entrypoints=https - traefik.http.routers.immich-secure.rule=Host(`${SERVICE_HOSTNAME}`) - traefik.http.routers.immich-secure.middlewares=secured-noauth@file - traefik.http.routers.immich-secure.tls=true - traefik.http.routers.immich-secure.service=immich - traefik.http.services.immich.loadbalancer.server.port=3001 - com.centurylinklabs.watchtower.enable=true - com.centurylinklabs.watchtower.monitor-only=true 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 networks: - proxy 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 networks: - proxy database: container_name: immich_postgres image: docker.io/tensorchord/pgvecto-rs:pg15-v0.2.0@sha256:d9847b0db25f3f00c6910e7b1e34085717f74f01da5f5a8cb7cdfe8d0267058b networks: - proxy 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-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 backup: container_name: immich_db_backup image: prodrigestivill/postgres-backup-local:15 restart: always env_file: - .env networks: - proxy environment: POSTGRES_HOST: database POSTGRES_CLUSTER: "TRUE" POSTGRES_USER: ${DB_USERNAME} POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_DB: ${DB_DATABASE_NAME} SCHEDULE: 0 5 4 * * * POSTGRES_EXTRA_OPTS: --clean --if-exists BACKUP_DIR: /db_dumps BACKUP_KEEP_DAYS: 7 BACKUP_KEEP_WEEKS: 4 BACKUP_KEEP_MONTHS: 2 WEBHOOK_URL: ${DB_BACKUP_WEBHOOK_URL} volumes: - /mnt/data/immich/db_backups:/db_dumps - /mnt/data/db-backup/00-kuma-webhoo.sh:/hooks/00-webhook labels: - com.centurylinklabs.watchtower.enable=true - com.centurylinklabs.watchtower.monitor-only=true depends_on: - database volumes: model-cache: null networks: proxy: external: true ``` ### Your .env content ```Shell LIBRARY_LOCATION=/mnt/photos/immich EXTERNAL_LOCATION=/mnt/photos/lib UPLOAD_LOCATION=/mnt/data/immich/uploads THUMB_LOCATION=/mnt/data/immich/thumbs ENCODED_VIDEO_LOCATION=/mnt/data/immich/encoded PROFILE_LOCATION=/mnt/data/immich/profile # The location where your database files are stored DB_DATA_LOCATION=/mnt/data/immich/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= # The Immich version to use. You can pin this to a specific version like "v1.71.0" IMMICH_VERSION=v1.107.0 # Connection secret for postgres. You should change it to a random password DB_PASSWORD= DB_HOSTNAME=immich_postgres REDIS_HOSTNAME=immich_redis DB_BACKUP_WEBHOOK_URL= # The values below this line do not need to be changed ################################################################################### DB_USERNAME= DB_DATABASE_NAME= SERVICE_HOSTNAME= ``` ### Reproduction steps ```bash 1. Delete some files 2. Try to Remove all / restore all 3. Note that it claims to have done so 4. Refresh page 5. See that the files are still there in the trash ``` ### Relevant log output _No response_ ### Additional information _No response_
Author
Owner

@alextran1502 commented on GitHub (Jul 3, 2024):

I assume all of those files are from an external library?

@alextran1502 commented on GitHub (Jul 3, 2024): I assume all of those files are from an external library?
Author
Owner

@bpbradley commented on GitHub (Jul 3, 2024):

I assume all of those files are from an external library?

No actually. Some were though.

@bpbradley commented on GitHub (Jul 3, 2024): > I assume all of those files are from an external library? No actually. Some were though.
Author
Owner

@alextran1502 commented on GitHub (Jul 3, 2024):

Can you help check the console network tab for the delete request and copy the body response?

@alextran1502 commented on GitHub (Jul 3, 2024): Can you help check the console network tab for the delete request and copy the body response?
Author
Owner

@bpbradley commented on GitHub (Jul 3, 2024):

Can you help check the console network tab for the delete request and copy the body response?

Sorry I am a dummy, where is the console network tab?

@bpbradley commented on GitHub (Jul 3, 2024): > Can you help check the console network tab for the delete request and copy the body response? Sorry I am a dummy, where is the console network tab?
Author
Owner

@bpbradley commented on GitHub (Jul 3, 2024):

Oh, I bet you mean chrome dev tools. One minute

@bpbradley commented on GitHub (Jul 3, 2024): Oh, I bet you mean chrome dev tools. One minute
Author
Owner

@bpbradley commented on GitHub (Jul 3, 2024):

Hmm is this it? {"message":"Cannot GET /api/trash/empty","error":"Not Found","statusCode":404,"correlationId":"..."}

Edit: Is the correlation ID safe to post? Not sure what it is.

@bpbradley commented on GitHub (Jul 3, 2024): Hmm is this it? `{"message":"Cannot GET /api/trash/empty","error":"Not Found","statusCode":404,"correlationId":"..."}` Edit: Is the correlation ID safe to post? Not sure what it is.
Author
Owner

@bpbradley commented on GitHub (Jul 3, 2024):

Note that it does say the assets are deleted. They just show back up after a refresh

@bpbradley commented on GitHub (Jul 3, 2024): Note that it does say the assets are deleted. They just show back up after a refresh
Author
Owner

@bpbradley commented on GitHub (Jul 3, 2024):

It seems hard to reproduce. I just tested by manually deleting some files and it worked as expected. I then deleted 100 or so via duplicate asset review, and now delete all is leaving back two items, neither of which are from external library (in the uploads dir, as shown)
image

@bpbradley commented on GitHub (Jul 3, 2024): It seems hard to reproduce. I just tested by manually deleting some files and it worked as expected. I then deleted 100 or so via duplicate asset review, and now delete all is leaving back two items, neither of which are from external library (in the uploads dir, as shown) ![image](https://github.com/immich-app/immich/assets/64746189/e89ba4f7-8c07-4029-a620-ed90da9ecf87)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#3787