IOS HEIC upload failing to process heif: Invalid input: No 'hvcC' box #4952

Closed
opened 2026-02-05 11:00:49 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @steve4835 on GitHub (Dec 16, 2024).

The bug

When uploading the attached photo, the processing fails with the following error, and fails to display both the timeline thumbnail and preview. I tried deleting and reuploading just to be sure. The photo was taken with the same phone, same settings, same day as other photos which processed successfully.

Edit, GitHub has decided that HEICs file uploads are not allowed for whatever reason, so I have linked a public Google Drive share: https://drive.google.com/file/d/1BaAcxCI84hU9pUIIek-D4vKETkiOdzm2/view?usp=sharing

The OS that Immich Server is running on

Debian Bookworm

Version of Immich Server

v1.122.3

Version of Immich Mobile App

v1.122.3

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

version: "3.8"

#
# 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}
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    depends_on:
      - redis
      - database
    restart: always

  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}
    # 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
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: always

  redis:
    container_name: immich_redis
    image: redis:6.2-alpine@sha256:51d6c56749a4243096327e3fb964a48ed92254357108449cb6e23999c37773c5
    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:
      - pgdata:/var/lib/postgresql/data
    restart: always

  nginx:
    image: nginx
    container_name: immich_nginx_proxy
    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
    ports:
      - "2283:2283"
    depends_on:
      - immich-server
    restart: always
volumes:
  pgdata:
  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/raid/immich

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

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

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

REDIS_HOSTNAME=immich_redis
TZ=America/Chicago

Reproduction steps

  1. Upload the attached photo (did so first through the app, and then via the web interface)
  2. Tail the logs with docker logs immich_server

Relevant log output

[Nest] 7  - 12/15/2024, 7:24:37 PM   ERROR [Microservices:JobService] Unable to run job handler (thumbnailGeneration/generate-thumbnails): Error: Input file has corrupt header: heif: Invalid input: No 'hvcC' box (2.106)
[Nest] 7  - 12/15/2024, 7:24:37 PM   ERROR [Microservices:JobService] Error: Input file has corrupt header: heif: Invalid input: No 'hvcC' box (2.106)
    at Sharp.toBuffer (/usr/src/app/node_modules/sharp/lib/output.js:163:17)
    at MediaRepository.decodeImage (/usr/src/app/dist/repositories/media.repository.js:57:68)
    at MediaService.generateImageThumbnails (/usr/src/app/dist/services/media.service.js:161:63)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async MediaService.handleGenerateThumbnails (/usr/src/app/dist/services/media.service.js:111:25)
    at async JobService.onJobStart (/usr/src/app/dist/services/job.service.js:148:28)
    at async EventRepository.onEvent (/usr/src/app/dist/repositories/event.repository.js:134:13)
    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] 7  - 12/15/2024, 7:24:37 PM   ERROR [Microservices:JobService] Object:
{
  "id": "1fd51bbf-5946-47ab-9098-612a46d732f7",
  "source": "upload"
}

Additional information

Using iPhone 15 Pro, on iOS 18.1.1, with 24MP HEIC photos

Originally created by @steve4835 on GitHub (Dec 16, 2024). ### The bug When uploading the attached photo, the processing fails with the following error, and fails to display both the timeline thumbnail and preview. I tried deleting and reuploading just to be sure. The photo was taken with the same phone, same settings, same day as other photos which processed successfully. Edit, GitHub has decided that HEICs file uploads are not allowed for whatever reason, so I have linked a public Google Drive share: https://drive.google.com/file/d/1BaAcxCI84hU9pUIIek-D4vKETkiOdzm2/view?usp=sharing ### The OS that Immich Server is running on Debian Bookworm ### Version of Immich Server v1.122.3 ### Version of Immich Mobile App v1.122.3 ### Platform with the issue - [X] Server - [ ] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML version: "3.8" # # 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} volumes: - ${UPLOAD_LOCATION}:/usr/src/app/upload - /etc/localtime:/etc/localtime:ro env_file: - .env depends_on: - redis - database restart: always 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} # 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 volumes: - model-cache:/cache env_file: - .env restart: always redis: container_name: immich_redis image: redis:6.2-alpine@sha256:51d6c56749a4243096327e3fb964a48ed92254357108449cb6e23999c37773c5 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: - pgdata:/var/lib/postgresql/data restart: always nginx: image: nginx container_name: immich_nginx_proxy volumes: - ./nginx.conf:/etc/nginx/conf.d/default.conf ports: - "2283:2283" depends_on: - immich-server restart: always volumes: pgdata: 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=/mnt/raid/immich # The Immich version to use. You can pin this to a specific version like "v1.71.0" IMMICH_VERSION="v1.122.3" # Connection secret for postgres. You should change it to a random password DB_PASSWORD=postgres # The values below this line do not need to be changed ################################################################################### DB_HOSTNAME=immich_postgres DB_USERNAME=postgres DB_DATABASE_NAME=immich REDIS_HOSTNAME=immich_redis TZ=America/Chicago ``` ### Reproduction steps 1. Upload the attached photo (did so first through the app, and then via the web interface) 2. Tail the logs with docker logs immich_server ### Relevant log output ```shell [Nest] 7 - 12/15/2024, 7:24:37 PM ERROR [Microservices:JobService] Unable to run job handler (thumbnailGeneration/generate-thumbnails): Error: Input file has corrupt header: heif: Invalid input: No 'hvcC' box (2.106) [Nest] 7 - 12/15/2024, 7:24:37 PM ERROR [Microservices:JobService] Error: Input file has corrupt header: heif: Invalid input: No 'hvcC' box (2.106) at Sharp.toBuffer (/usr/src/app/node_modules/sharp/lib/output.js:163:17) at MediaRepository.decodeImage (/usr/src/app/dist/repositories/media.repository.js:57:68) at MediaService.generateImageThumbnails (/usr/src/app/dist/services/media.service.js:161:63) at process.processTicksAndRejections (node:internal/process/task_queues:105:5) at async MediaService.handleGenerateThumbnails (/usr/src/app/dist/services/media.service.js:111:25) at async JobService.onJobStart (/usr/src/app/dist/services/job.service.js:148:28) at async EventRepository.onEvent (/usr/src/app/dist/repositories/event.repository.js:134:13) 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] 7 - 12/15/2024, 7:24:37 PM ERROR [Microservices:JobService] Object: { "id": "1fd51bbf-5946-47ab-9098-612a46d732f7", "source": "upload" } ``` ### Additional information Using iPhone 15 Pro, on iOS 18.1.1, with 24MP HEIC photos
Author
Owner

@steve4835 commented on GitHub (Dec 16, 2024):

Looks like this discussion is related: https://github.com/immich-app/immich/discussions/14490

@steve4835 commented on GitHub (Dec 16, 2024): Looks like this discussion is related: https://github.com/immich-app/immich/discussions/14490
Author
Owner

@steve4835 commented on GitHub (Dec 16, 2024):

After further investigation, it looks (according to ffprobe) as if the file actually is corrupted. iOS displays it in the camera roll fine, but even when trying to use the built in photo editor it fails to save.

This ticket can be closed, it looks like it's an iOS issue.

@steve4835 commented on GitHub (Dec 16, 2024): After further investigation, it looks (according to `ffprobe`) as if the file actually is corrupted. iOS displays it in the camera roll fine, but even when trying to use the built in photo editor it fails to save. This ticket can be closed, it looks like it's an iOS issue.
Author
Owner

@Goorzhel commented on GitHub (Jan 4, 2026):

This is https://github.com/strukturag/libheif/issues/1448, which was fixed in 1.21.0. Here's a demonstration using the image you linked:

1.20.2
❯ heif-info --version
1.20.2
libheif: 1.20.2
plugin path: /nix/store/01ddsmlfxa22al7yxasdj8rvm72b275m-libheif-1.20.2-lib/lib/libheif
❯ heif-info IMG_6939.HEIC
MIME type: image/heic
main brand: heic
compatible brands: mif1, MiHB, MiHE, MiPr, miaf, heic, tmap
Could not read HEIF/AVIF file: Invalid input: No 'hvcC' box
1.21.0
❯ heif-info --version
1.21.0
libheif: 1.21.0
plugin path: /nix/store/3cvwm99vf7d1n5xxjlmrbq9m0ygmgp4f-libheif-v1.21.0-lib/lib/libheif
❯ heif-info IMG_6939.HEIC
MIME type: image/heic
main brand: heic
compatible brands: mif1, MiHB, MiHE, MiPr, miaf, heic, tmap

image: 5712x4284 (id=46), primary
  tiles: 9x5, tile size: 640x896
  colorspace: YCbCr, 4:2:0
  bit depth: 8
  thumbnail: 416x312
  color profile: prof
  alpha channel: no
  depth channel: no
metadata:
  Exif: 2878 bytes
transformations:
  angle (ccw): 0
region annotations:
  none
text items:
  none
properties:
none
MIME items:
  64 : application/rdf+xml

We need only await this dependency chain:

  • sharp-libvips to use libheif 1.21.x (a release candidate does);
  • sharp to use the new sharp-libvips, when the latter is released; and
  • immich to use the new sharp, when the latter is released.
@Goorzhel commented on GitHub (Jan 4, 2026): This is https://github.com/strukturag/libheif/issues/1448, which was fixed in `1.21.0`. Here's a demonstration using the image you linked: <details><summary>1.20.2</summary> ``` ❯ heif-info --version 1.20.2 libheif: 1.20.2 plugin path: /nix/store/01ddsmlfxa22al7yxasdj8rvm72b275m-libheif-1.20.2-lib/lib/libheif ❯ heif-info IMG_6939.HEIC MIME type: image/heic main brand: heic compatible brands: mif1, MiHB, MiHE, MiPr, miaf, heic, tmap Could not read HEIF/AVIF file: Invalid input: No 'hvcC' box ``` </details> <details><summary>1.21.0</summary> ``` ❯ heif-info --version 1.21.0 libheif: 1.21.0 plugin path: /nix/store/3cvwm99vf7d1n5xxjlmrbq9m0ygmgp4f-libheif-v1.21.0-lib/lib/libheif ❯ heif-info IMG_6939.HEIC MIME type: image/heic main brand: heic compatible brands: mif1, MiHB, MiHE, MiPr, miaf, heic, tmap image: 5712x4284 (id=46), primary tiles: 9x5, tile size: 640x896 colorspace: YCbCr, 4:2:0 bit depth: 8 thumbnail: 416x312 color profile: prof alpha channel: no depth channel: no metadata: Exif: 2878 bytes transformations: angle (ccw): 0 region annotations: none text items: none properties: none MIME items: 64 : application/rdf+xml ``` </details> We need only await this dependency chain: - `sharp-libvips` to use `libheif` `1.21.x` (a [release candidate](https://github.com/lovell/sharp-libvips/releases/tag/v1.3.0-rc.2) does); - `sharp` to use the new `sharp-libvips`, when the latter is released; and - `immich` to use the new `sharp`, when the latter is released.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#4952