Some (probably quite broken) JPEG files are not parsed and are no thumbnail can be generated. #3598

Closed
opened 2026-02-05 09:05:45 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @saua on GitHub (Jun 20, 2024).

The bug

My young son got a cheap kids toy camera that stores pictures to an SD card and I upload them to immich. While pretty much every tool I throw at them can display the images correctly, Immich seems to have a problem at some point,

The OS that Immich Server is running on

Debian Bookworm

Version of Immich Server

v1.106.4

Version of Immich Mobile App

v1.106.3

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

version: "3.8"

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
    restart: always
    networks:
      - default
      - proxy
    labels:
      - traefik.enable=true
      - traefik.http.routers.immich-server.rule=Host(`immich.nottherealdomain.com`)
      - traefik.http.routers.immich-server.entrypoints=https
      - traefik.http.routers.immich-server.tls=true
      - traefik.http.services.immich-server.loadbalancer.server.port=3001

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: always

  redis:
    container_name: immich_redis
    image: redis:6.2-alpine@sha256:70a7a5b641117670beae0d80658430853896b5ef269ccf00d1827427e3263fa3
    volumes:
      - redisdata:/data
    restart: always

  database:
    container_name: immich_postgres
    image: tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
    env_file:
      - .env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - ${DB_DATA_LOCATION}:/var/lib/postgresql/data
      - ${UPLOAD_LOCATION}/db-backup:/db-backup
    restart: always

volumes:
  model-cache:
  redisdata:

networks:
  proxy:
    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=/tank/media/photos
# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=release

# Connection secrets for postgres and typesense. You should change these to random passwords
TYPESENSE_API_KEY=dummyvalue
DB_PASSWORD=dummypassword

# The values below this line do not need to be changed
###################################################################################
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=immich
DB_DATA_LOCATION=/tank/media/photos/postgres

REDIS_HOSTNAME=immich_redis

DISABLE_REVERSE_GEOCODING=false
REVERSE_GEOCODING_PRECISION=3

PUBLIC_LOGIN_PAGE_MESSAGE="Dummy Message"

Reproduction steps

1. Upload the provided image to immich (using the web upload, but I don't think it matters)
2. Open the gallery, see a broken thumbnail
3. Click on the broken thumnail, fail to see the image
4. (Bonus: downloading the original works just fine)

Relevant log output

[Nest] 6  - 06/20/2024, 6:03:20 PM   ERROR [Microservices:JobService] Unable to run job handler (thumbnailGeneration/generate-preview): Error: VipsJpeg: Corrupt JPEG data: 4 extraneous bytes before marker 0xd7
[Nest] 6  - 06/20/2024, 6:03:20 PM   ERROR [Microservices:JobService] Error: VipsJpeg: Corrupt JPEG data: 4 extraneous bytes before marker 0xd7
    at Sharp.toFile (/usr/src/app/node_modules/sharp/lib/output.js:89:19)
    at MediaRepository.generateThumbnail (/usr/src/app/dist/repositories/media.repository.js:69:14)
    at MediaService.generateThumbnail (/usr/src/app/dist/services/media.service.js:158:48)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async MediaService.handleGeneratePreview (/usr/src/app/dist/services/media.service.js:135:29)
    at async /usr/src/app/dist/services/job.service.js:148:36
    at async Worker.processJob (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:394:28)
    at async Worker.retryIfFailed (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:581:24)
[Nest] 6  - 06/20/2024, 6:03:20 PM   ERROR [Microservices:JobService] Object:
{
  "id": "15efd81e-8162-43c9-9977-a410ca2a95cd"
}

[Nest] 6  - 06/20/2024, 6:03:20 PM   ERROR [Microservices:JobService] Unable to run job handler (thumbnailGeneration/generate-preview): Error: VipsJpeg: Corrupt JPEG data: 14 extraneous bytes before marker 0xd1
[Nest] 6  - 06/20/2024, 6:03:20 PM   ERROR [Microservices:JobService] Error: VipsJpeg: Corrupt JPEG data: 14 extraneous bytes before marker 0xd1
    at Sharp.toFile (/usr/src/app/node_modules/sharp/lib/output.js:89:19)
    at MediaRepository.generateThumbnail (/usr/src/app/dist/repositories/media.repository.js:69:14)
    at MediaService.generateThumbnail (/usr/src/app/dist/services/media.service.js:158:48)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async MediaService.handleGeneratePreview (/usr/src/app/dist/services/media.service.js:135:29)
    at async /usr/src/app/dist/services/job.service.js:148:36
    at async Worker.processJob (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:394:28)
    at async Worker.retryIfFailed (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:581:24)
[Nest] 6  - 06/20/2024, 6:03:20 PM   ERROR [Microservices:JobService] Object:
{
  "id": "510a3c3f-842c-41c6-aa0c-00e66ce6a8c6"
}

Additional information

I've not verified that the provided log messages are for this specific image and the number of extraneous bytes before the problematic marker varies.

PICT0485

Originally created by @saua on GitHub (Jun 20, 2024). ### The bug My young son got a cheap kids toy camera that stores pictures to an SD card and I upload them to immich. While pretty much every tool I throw at them can display the images correctly, Immich seems to have a problem at some point, ### The OS that Immich Server is running on Debian Bookworm ### Version of Immich Server v1.106.4 ### Version of Immich Mobile App v1.106.3 ### Platform with the issue - [X] Server - [ ] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML version: "3.8" services: immich-server: container_name: immich_server image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release} volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload - /etc/localtime:/etc/localtime:ro env_file: - .env depends_on: - redis - database restart: always networks: - default - proxy labels: - traefik.enable=true - traefik.http.routers.immich-server.rule=Host(`immich.nottherealdomain.com`) - traefik.http.routers.immich-server.entrypoints=https - traefik.http.routers.immich-server.tls=true - traefik.http.services.immich-server.loadbalancer.server.port=3001 immich-machine-learning: container_name: immich_machine_learning image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release} volumes: - model-cache:/cache env_file: - .env restart: always redis: container_name: immich_redis image: redis:6.2-alpine@sha256:70a7a5b641117670beae0d80658430853896b5ef269ccf00d1827427e3263fa3 volumes: - redisdata:/data restart: always database: container_name: immich_postgres image: tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0 env_file: - .env environment: POSTGRES_PASSWORD: ${DB_PASSWORD} POSTGRES_USER: ${DB_USERNAME} POSTGRES_DB: ${DB_DATABASE_NAME} volumes: - ${DB_DATA_LOCATION}:/var/lib/postgresql/data - ${UPLOAD_LOCATION}/db-backup:/db-backup restart: always volumes: model-cache: redisdata: networks: proxy: external: true ``` ### 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=/tank/media/photos # The Immich version to use. You can pin this to a specific version like "v1.71.0" IMMICH_VERSION=release # Connection secrets for postgres and typesense. You should change these to random passwords TYPESENSE_API_KEY=dummyvalue DB_PASSWORD=dummypassword # The values below this line do not need to be changed ################################################################################### DB_HOSTNAME=immich_postgres DB_USERNAME=postgres DB_DATABASE_NAME=immich DB_DATA_LOCATION=/tank/media/photos/postgres REDIS_HOSTNAME=immich_redis DISABLE_REVERSE_GEOCODING=false REVERSE_GEOCODING_PRECISION=3 PUBLIC_LOGIN_PAGE_MESSAGE="Dummy Message" ``` ### Reproduction steps ```bash 1. Upload the provided image to immich (using the web upload, but I don't think it matters) 2. Open the gallery, see a broken thumbnail 3. Click on the broken thumnail, fail to see the image 4. (Bonus: downloading the original works just fine) ``` ### Relevant log output ```shell [Nest] 6 - 06/20/2024, 6:03:20 PM ERROR [Microservices:JobService] Unable to run job handler (thumbnailGeneration/generate-preview): Error: VipsJpeg: Corrupt JPEG data: 4 extraneous bytes before marker 0xd7 [Nest] 6 - 06/20/2024, 6:03:20 PM ERROR [Microservices:JobService] Error: VipsJpeg: Corrupt JPEG data: 4 extraneous bytes before marker 0xd7 at Sharp.toFile (/usr/src/app/node_modules/sharp/lib/output.js:89:19) at MediaRepository.generateThumbnail (/usr/src/app/dist/repositories/media.repository.js:69:14) at MediaService.generateThumbnail (/usr/src/app/dist/services/media.service.js:158:48) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async MediaService.handleGeneratePreview (/usr/src/app/dist/services/media.service.js:135:29) at async /usr/src/app/dist/services/job.service.js:148:36 at async Worker.processJob (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:394:28) at async Worker.retryIfFailed (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:581:24) [Nest] 6 - 06/20/2024, 6:03:20 PM ERROR [Microservices:JobService] Object: { "id": "15efd81e-8162-43c9-9977-a410ca2a95cd" } [Nest] 6 - 06/20/2024, 6:03:20 PM ERROR [Microservices:JobService] Unable to run job handler (thumbnailGeneration/generate-preview): Error: VipsJpeg: Corrupt JPEG data: 14 extraneous bytes before marker 0xd1 [Nest] 6 - 06/20/2024, 6:03:20 PM ERROR [Microservices:JobService] Error: VipsJpeg: Corrupt JPEG data: 14 extraneous bytes before marker 0xd1 at Sharp.toFile (/usr/src/app/node_modules/sharp/lib/output.js:89:19) at MediaRepository.generateThumbnail (/usr/src/app/dist/repositories/media.repository.js:69:14) at MediaService.generateThumbnail (/usr/src/app/dist/services/media.service.js:158:48) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async MediaService.handleGeneratePreview (/usr/src/app/dist/services/media.service.js:135:29) at async /usr/src/app/dist/services/job.service.js:148:36 at async Worker.processJob (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:394:28) at async Worker.retryIfFailed (/usr/src/app/node_modules/bullmq/dist/cjs/classes/worker.js:581:24) [Nest] 6 - 06/20/2024, 6:03:20 PM ERROR [Microservices:JobService] Object: { "id": "510a3c3f-842c-41c6-aa0c-00e66ce6a8c6" } ``` ### Additional information I've not verified that the provided log messages are for this specific image and the number of extraneous bytes before the problematic marker varies. ![PICT0485](https://github.com/immich-app/immich/assets/1699588/f8e4cfff-0fc7-46a3-b317-591caa6a8bf1)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#3598