Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect deleted / moved files properly #15692

Closed
1 of 3 tasks
JVT038 opened this issue Jan 26, 2025 · 5 comments
Closed
1 of 3 tasks

Detect deleted / moved files properly #15692

JVT038 opened this issue Jan 26, 2025 · 5 comments

Comments

@JVT038
Copy link

JVT038 commented Jan 26, 2025

The bug

I usually store my photos and videos on my SD card, but unfortunately I had to get a new one, because the old SD card got corrupted.

Due to the corrupted state of the SD card, I was unable to move the files from the old SD card to the new SD card.

Immich thinks a lot of files are locally stored on my SD card, so it'll try and view the images and videos from the SD card. However, it doesn't realize that all the media is gone, because I have a new SD card.

When playing a video, Immich doesn't crash; instead, it stays spinning and doesn't play the video either; I have attached the ADB logs below.

Furthermore, when trying to view an image (stored on the old SD card, with external pictures disabled), it simply doesn't work and the blurhash is displayed instead. Additionally, the ADB log simply spams Failed to create image decoder with message 'unimplemented' for each image it tries (and fails) to display.

To fix this issue, I propose that Immich always checks if the item exists and if it doesn't exist, it will fallback to the online version of the item stored on the server and try to play that instead.

The OS that Immich Server is running on

Synology DSM 7.2

Version of Immich Server

v1.125.1

Version of Immich Mobile App

v1.125.1 build.2177

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

version: "3.8"

name: immich

networks:
  traefik:
    external: true
    name: traefik_proxy

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:release
    networks:
      - traefik
      - default
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - sockets:/sockets
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    depends_on:
      - redis
      - database
    restart: always
    extends:
      file: hwaccel.transcoding.yml
      service: hwaccel
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=traefik_proxy"
      ## HTTP Routers
      - traefik.http.routers.immich-rtr.rule=Host(`immich.$DOMAINNAME`)
      - traefik.http.routers.immich-rtr.entrypoints=https
      - traefik.http.routers.immich-rtr.tls=true
      - traefik.http.routers.immich-rtr.priority=10
      - traefik.http.routers.immich-rtr.service=immich-svc
      - traefik.http.routers.immich-rtr.middlewares=chain-basic@file
      - traefik.http.services.immich-svc.loadbalancer.server.port=2283

  immich-machine-learning:
    build:
      context: $DOCKERDIR/immich/immich-ml
      dockerfile: Dockerfile
    container_name: immich_machine_learning
    networks:
      - default
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - model-cache:/cache
    env_file:
      - .env
    environment:
      - NODE_ENV=production
    restart: always

  redis:
    container_name: immich_redis
    image: redis:6.2
    restart: always
    healthcheck:
      test: redis-cli ping || exit 1
    networks:
      - default
    command: redis-server /etc/redis.conf
    volumes:
      - sockets:/sockets
      - $DOCKERDIR/immich/redis.conf:/etc/redis.conf
      - /etc/TZ:/etc/timezone:ro
      - $DOCKERDIR/immich/redisdb:/db

  database:
    container_name: immich_postgres
    # image: tensorchord/pgvecto-rs:pg14-v0.2.0
    image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0
    # user: 1026:100
    command: postgres -c unix_socket_directories='/var/run/postgresql/,/sockets/' -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
    # command: ["postgres", "-c", "unix_socket_directories='/var/run/postgresql/,/sockets/'", "-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"]
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      PG_DATA: /var/lib/postgresql/data
      PGPORT: ${DB_PORT}
      POSTGRES_INITDB_ARGS: '--data-checksums'
    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 SUM(checksum_failures) FROM pg_stat_database')"; echo "checksum failure count is $$Chksum"; [ "$$Chksum" = '0' ] || exit 1
      interval: 5m
      start_period: 5m
    volumes:
      - $DOCKERDIR/immich/pgdata:/var/lib/postgresql/data
      - sockets:/sockets
    restart: always

volumes:
  sockets:
    external: true
  model-cache:

Your .env content

DB_HOSTNAME=/sockets
DB_USERNAME=postgres
DB_PASSWORD=postgres
DB_DATABASE_NAME=immich
DB_PORT=5433
REDIS_PASSWORD="<password>"
REDIS_SOCKET=/sockets/immich_redis.sock
UPLOAD_LOCATION=$DOCKERDIR/immich/gallery
JWT_SECRET=<secret>
TYPESENSE_API_KEY=<key>

Reproduction steps

  1. Delete an image and/or video
  2. Try to view something that's been deleted in Immich
  3. See error

Relevant log output

Error when playing video:

01-26 19:52:16.025  9867  9893 I flutter : [SEVERE] [2025-01-26 19:52:16.025093] Error creating video source for asset VID_20241130_205512.mp4: PlatformException(The getFullFile method has an error: Failed to find asset 1000015208, java.lang.RuntimeException: Failed to find asset 1000015208
01-26 19:52:16.025  9867  9893 I flutter :      at E2.i$b.L(Unknown Source:7)
01-26 19:52:16.025  9867  9893 I flutter :      at E2.d.y(Unknown Source:0)
01-26 19:52:16.025  9867  9893 I flutter :      at E2.i$b.K(Unknown Source:22)
01-26 19:52:16.025  9867  9893 I flutter :      at E2.d.j(Unknown Source:0)
01-26 19:52:16.025  9867  9893 I flutter :      at E2.d.b(Unknown Source:45)
01-26 19:52:16.025  9867  9893 I flutter :      at A2.b.p(Unknown Source:16)
01-26 19:52:16.025  9867  9893 I flutter :      at A2.m.j(Unknown Source:961)
01-26 19:52:16.025  9867  9893 I flutter :      at A2.m.n(Unknown Source:8)
01-26 19:52:16.025  9867  9893 I flutter :      at A2.m.b(Unknown Source:0)
01-26 19:52:16.025  9867  9893 I flutter :      at A2.l.c(Unknown Source:4)
01-26 19:52:16.025  9867  9893 I flutter :      at A2.m$b.c(Unknown Source:0)
01-26 19:52:16.025  9867  9893 I flutter :      at A2.m$b.a(Unknown Source:0)
01-26 19:52:16.025  9867  9893 I flutter :      at A2.n.run(Unknown Source:2)
01-26 19:52:16.025  9867  9893 I flutter :      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
01-26 19:52:16.025  9867  9893 I flutter :      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
01-26 19:52:16.025  9867  9893 I flutter :      at java.lang.Thread.run(Thread.java:1012)
01-26 19:52:16.025  9867  9893 I flutter : , {darwinFileType: 0, subtype: 0, id: 1000015208, isOrigin: false}, null)
01-26 19:52:16.025  9867  9893 I flutter : [SEVERE] [2025-01-26 19:52:16.025490] Error getting aspect ratio for asset VID_20241130_205512.mp4: Exception: Could not fetch local data for VID_20241130_205512.mp4
01-26 19:52:16.121  9867  9895 E FlutterJNI: Failed to decode image
01-26 19:52:16.121  9867  9895 E FlutterJNI: android.graphics.ImageDecoder$DecodeException: Failed to create image decoder with message 'unimplemented'Input contained an error.
01-26 19:52:16.121  9867  9895 E FlutterJNI:    at android.graphics.ImageDecoder.nCreate(Native Method)
01-26 19:52:16.121  9867  9895 E FlutterJNI:    at android.graphics.ImageDecoder.-$$Nest$smnCreate(Unknown Source:0)
01-26 19:52:16.121  9867  9895 E FlutterJNI:    at android.graphics.ImageDecoder$ByteBufferSource.createImageDecoder(ImageDecoder.java:254)
01-26 19:52:16.121  9867  9895 E FlutterJNI:    at android.graphics.ImageDecoder.decodeBitmapImpl(ImageDecoder.java:1856)
01-26 19:52:16.121  9867  9895 E FlutterJNI:    at android.graphics.ImageDecoder.decodeBitmap(ImageDecoder.java:1848)
01-26 19:52:16.121  9867  9895 E FlutterJNI:    at h2.e.a(Unknown Source:0)
01-26 19:52:16.121  9867  9895 E FlutterJNI:    at io.flutter.embedding.engine.FlutterJNI.decodeImage(Unknown Source:16)
01-26 19:52:16.123  9867  9893 I flutter : [SEVERE] [2025-01-26 19:52:16.123010] FlutterError - Catch all

Additional information

No response

@alextran1502
Copy link
Contributor

Does signing out and in again help?

@bo0tzz
Copy link
Member

bo0tzz commented Jan 26, 2025

You should have backups.

@bo0tzz bo0tzz closed this as completed Jan 26, 2025
@bo0tzz
Copy link
Member

bo0tzz commented Jan 26, 2025

My bad, I thought you were talking about the server

@bo0tzz
Copy link
Member

bo0tzz commented Jan 26, 2025

Actually a duplicate of #15079

@JVT038
Copy link
Author

JVT038 commented Jan 26, 2025

You should have backups.

Fortunately, I have backups on my Immich server ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants