originalPath from assets do not exist on disk #4486

Closed
opened 2026-02-05 10:35:37 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @rayzorben on GitHub (Oct 6, 2024).

The bug

I've noticed some issues with missing files and some errors in docker when uploading, so I wanted to do a sanity check. I dumped all originalPath's stored in the assets table and compared them to what is on disk. I see quite a few 'missing' files where Immich believes there should be a file but there isn't.

\o paths.txt
select "originalPath" from assets;
[/collective/dropbox/Pictures/library/admin/2017/2017-07/2017-07-24 12.08.39.638.JPG] does not exist on disk
root@server /c/a/immich [SIGINT]# ls "/collective/dropbox/Pictures/library/admin/2017/2017-07/2017-07-24 12.08.39.638.JPG"
ls: cannot access '/collective/dropbox/Pictures/library/admin/2017/2017-07/2017-07-24 12.08.39.638.JPG': No such file or directory
root@server /c/a/immich [2]# ls "/collective/dropbox/Pictures/library/admin/2017/2017-07/2017-07-24 12.08.39.638*"
ls: cannot access '/collective/dropbox/Pictures/library/admin/2017/2017-07/2017-07-24 12.08.39.638*': No such file or directory

Now i'm not saying there is a bug, perhaps there are some additional checks I need to do along with this, but I am not sure what? It is concerning to me that A LOT of files are missing.

The OS that Immich Server is running on

Proxmox

Version of Immich Server

v1.117.0

Version of Immich Mobile App

NA

Platform with the issue

  • Server
  • Web
  • Mobile

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: quicksync # set to one of [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
      - /storage/dropbox:/dropbox
      - /storage/appdata/immich/config:/root/.config/immich
    env_file:
      - .env
    ports:
      - 2283:3001
      - 8003:8003 # for google photo album sync
    depends_on:
      - redis
      - database
    restart: unless-stopped

  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 [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: unless-stopped

  redis:
    container_name: immich_redis
    image: docker.io/redis:6.2-alpine@sha256:2d1463258f2764328496376f5d965f20c6a67f66ea2b06dc42af351f75248792
    restart: unless-stopped

  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
    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: unless-stopped


  power-tools:
    container_name: immich_power_tools
    image: ghcr.io/varun-raj/immich-power-tools:latest
    ports:
      - "8001:3000"
    env_file:
      - .env
    restart: unless-stopped

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=/storage/dropbox/Pictures
# The location where your database files are stored
DB_DATA_LOCATION=/storage/appdata/immich/db

# 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=America/Los_Angeles

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

# 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=hunter2

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

IMMICH_API_KEY=MYKEY
IMMICH_URL="http://192.168.1.xx:2283" # Your immich instace ip address and port
EXTERNAL_IMMICH_URL="http://photos.xxx.com" # External address of immich

Reproduction steps

Pull originalPath as stated and then do a check

#!/bin/bash

# Define the prefix that needs to be replaced
prefix="upload"
actual_prefix="/collective/dropbox/Pictures"

# Read paths from paths.txt
while IFS= read -r path; do
    # Replace 'upload' with the actual directory path
    path=$(echo "$path" | xargs)
    actual_path=${path/$prefix/$actual_prefix}
    
    # Check if the file exists
    if [ ! -f "$actual_path" ]; then
        echo "[$actual_path] does not exist on disk"
    fi
done < paths.txt

Relevant log output

No response

Additional information

No response

Originally created by @rayzorben on GitHub (Oct 6, 2024). ### The bug I've noticed some issues with missing files and some errors in docker when uploading, so I wanted to do a sanity check. I dumped all originalPath's stored in the assets table and compared them to what is on disk. I see quite a few 'missing' files where Immich believes there should be a file but there isn't. ```psql \o paths.txt select "originalPath" from assets; ``` ```bash [/collective/dropbox/Pictures/library/admin/2017/2017-07/2017-07-24 12.08.39.638.JPG] does not exist on disk root@server /c/a/immich [SIGINT]# ls "/collective/dropbox/Pictures/library/admin/2017/2017-07/2017-07-24 12.08.39.638.JPG" ls: cannot access '/collective/dropbox/Pictures/library/admin/2017/2017-07/2017-07-24 12.08.39.638.JPG': No such file or directory root@server /c/a/immich [2]# ls "/collective/dropbox/Pictures/library/admin/2017/2017-07/2017-07-24 12.08.39.638*" ls: cannot access '/collective/dropbox/Pictures/library/admin/2017/2017-07/2017-07-24 12.08.39.638*': No such file or directory ``` Now i'm not saying there is a bug, perhaps there are some additional checks I need to do along with this, but I am not sure what? It is concerning to me that A LOT of files are missing. ### The OS that Immich Server is running on Proxmox ### Version of Immich Server v1.117.0 ### Version of Immich Mobile App NA ### Platform with the issue - [X] Server - [ ] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML # # 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: quicksync # set to one of [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 - /storage/dropbox:/dropbox - /storage/appdata/immich/config:/root/.config/immich env_file: - .env ports: - 2283:3001 - 8003:8003 # for google photo album sync depends_on: - redis - database restart: unless-stopped 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 [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable volumes: - model-cache:/cache env_file: - .env restart: unless-stopped redis: container_name: immich_redis image: docker.io/redis:6.2-alpine@sha256:2d1463258f2764328496376f5d965f20c6a67f66ea2b06dc42af351f75248792 restart: unless-stopped 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 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: unless-stopped power-tools: container_name: immich_power_tools image: ghcr.io/varun-raj/immich-power-tools:latest ports: - "8001:3000" env_file: - .env restart: unless-stopped volumes: model-cache: ``` ### Your .env content ```Shell # 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=/storage/dropbox/Pictures # The location where your database files are stored DB_DATA_LOCATION=/storage/appdata/immich/db # 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=America/Los_Angeles # The Immich version to use. You can pin this to a specific version like "v1.71.0" IMMICH_VERSION=release # 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=hunter2 # The values below this line do not need to be changed ################################################################################### DB_USERNAME=postgres DB_DATABASE_NAME=immich IMMICH_API_KEY=MYKEY IMMICH_URL="http://192.168.1.xx:2283" # Your immich instace ip address and port EXTERNAL_IMMICH_URL="http://photos.xxx.com" # External address of immich ``` ### Reproduction steps Pull originalPath as stated and then do a check ```bash #!/bin/bash # Define the prefix that needs to be replaced prefix="upload" actual_prefix="/collective/dropbox/Pictures" # Read paths from paths.txt while IFS= read -r path; do # Replace 'upload' with the actual directory path path=$(echo "$path" | xargs) actual_path=${path/$prefix/$actual_prefix} # Check if the file exists if [ ! -f "$actual_path" ]; then echo "[$actual_path] does not exist on disk" fi done < paths.txt ``` ### Relevant log output _No response_ ### Additional information _No response_
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#4486