Some HEIC image files not able to generate thumbnails #7692

Closed
opened 2026-02-05 13:14:08 +03:00 by OVERLORD · 6 comments
Owner

Originally created by @hasmar04 on GitHub (Nov 1, 2025).

I have searched the existing issues, both open and closed, to make sure this is not a duplicate report.

  • Yes

The bug

Some heif images, for a reason I cannot figure out, are unable to generate thumbnails when uploaded to Immich.
Here is an example broken file - https://www.harrisonasmar.com/20250104_203958.heic
Here is an example working file - https://www.harrisonasmar.com/20250104_204009.heic
The photos have been downloaded from Google Photos using Google Takeout, and uploaded using Immich-Go. However, on my Linux laptop in Gwenview, it also cannot open this specific broken HEIC file, but can open the working one just fine.

The OS that Immich Server is running on

TrueNAS 25.04.2.6

Version of Immich Server

2.2.0

Version of Immich Mobile App

2.2.0 build.3023

Platform with the issue

  • Server
  • Web
  • Mobile

Device make and model

Samsung S25

Your docker-compose.yml content

TrueNAS app, so cannot access this. 
Followed Immich setup guide - https://docs.immich.app/install/truenas

Your .env content

As above, cannot be accessed in TrueNAS

Reproduction steps

  1. Download above photo
  2. Upload to Immich
  3. View logs when thumbnail is attempted to be generated

Relevant log output

[31m[Nest] 7  - 11/01/2025, 6:56:05 PM   ERROR [Microservices:{"id":"0ec37b6d-e700-45dc-8335-f3981ff2c609"}] Unable to run job handler (AssetGenerateThumbnails): Error: Input file has corrupt header: /data/upload/d23d0d4d-1b5b-4f43-8e2f-c91afc9cb9b0/1e/be/1ebe697f-b4e0-41d1-9450-16753f6c62c8.heic: bad seek to 1753886992
2025-11-01 08:56:05.318108+00:00heif: Invalid input: Unexpected end of file (2.100)
2025-11-01 08:56:05.318782+00:00Error: Input file has corrupt header: /data/upload/d23d0d4d-1b5b-4f43-8e2f-c91afc9cb9b0/1e/be/1ebe697f-b4e0-41d1-9450-16753f6c62c8.heic: bad seek to 1753886992
2025-11-01 08:56:05.318812+00:00heif: Invalid input: Unexpected end of file (2.100)
2025-11-01 08:56:05.318850+00:00at Sharp.toBuffer (/usr/src/app/server/node_modules/.pnpm/sharp@0.34.4/node_modules/sharp/lib/output.js:163:17)
2025-11-01 08:56:05.318859+00:00at MediaRepository.decodeImage (/usr/src/app/server/dist/repositories/media.repository.js:105:68)
2025-11-01 08:56:05.318871+00:00at MediaService.decodeImage (/usr/src/app/server/dist/services/media.service.js:177:59)
2025-11-01 08:56:05.318889+00:00at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
2025-11-01 08:56:05.318901+00:00at async MediaService.generateImageThumbnails (/usr/src/app/server/dist/services/media.service.js:190:44)
2025-11-01 08:56:05.318910+00:00at async MediaService.handleGenerateThumbnails (/usr/src/app/server/dist/services/media.service.js:116:25)
2025-11-01 08:56:05.318926+00:00at async JobService.onJobRun (/usr/src/app/server/dist/services/job.service.js:199:30)
2025-11-01 08:56:05.318938+00:00at async EventRepository.onEvent (/usr/src/app/server/dist/repositories/event.repository.js:91:13)
2025-11-01 08:56:05.318946+00:00at async /usr/src/app/server/node_modules/.pnpm/bullmq@5.61.2/node_modules/bullmq/dist/cjs/classes/worker.js:528:32

Additional information

Other photos taken at the same time, of the same things, with the same camera, do not have this issue. Only certain photos at seemingly random times encounter this.

Originally created by @hasmar04 on GitHub (Nov 1, 2025). ### I have searched the existing issues, both open and closed, to make sure this is not a duplicate report. - [x] Yes ### The bug Some heif images, for a reason I cannot figure out, are unable to generate thumbnails when uploaded to Immich. Here is an example broken file - https://www.harrisonasmar.com/20250104_203958.heic Here is an example working file - https://www.harrisonasmar.com/20250104_204009.heic The photos have been downloaded from Google Photos using Google Takeout, and uploaded using Immich-Go. However, on my Linux laptop in Gwenview, it also cannot open this specific broken HEIC file, but can open the working one just fine. ### The OS that Immich Server is running on TrueNAS 25.04.2.6 ### Version of Immich Server 2.2.0 ### Version of Immich Mobile App 2.2.0 build.3023 ### Platform with the issue - [x] Server - [ ] Web - [ ] Mobile ### Device make and model Samsung S25 ### Your docker-compose.yml content ```YAML TrueNAS app, so cannot access this. Followed Immich setup guide - https://docs.immich.app/install/truenas ``` ### Your .env content ```Shell As above, cannot be accessed in TrueNAS ``` ### Reproduction steps 1. Download above photo 2. Upload to Immich 3. View logs when thumbnail is attempted to be generated ### Relevant log output ```shell [31m[Nest] 7 - 11/01/2025, 6:56:05 PM  ERROR [Microservices:{"id":"0ec37b6d-e700-45dc-8335-f3981ff2c609"}] Unable to run job handler (AssetGenerateThumbnails): Error: Input file has corrupt header: /data/upload/d23d0d4d-1b5b-4f43-8e2f-c91afc9cb9b0/1e/be/1ebe697f-b4e0-41d1-9450-16753f6c62c8.heic: bad seek to 1753886992 2025-11-01 08:56:05.318108+00:00heif: Invalid input: Unexpected end of file (2.100) 2025-11-01 08:56:05.318782+00:00Error: Input file has corrupt header: /data/upload/d23d0d4d-1b5b-4f43-8e2f-c91afc9cb9b0/1e/be/1ebe697f-b4e0-41d1-9450-16753f6c62c8.heic: bad seek to 1753886992 2025-11-01 08:56:05.318812+00:00heif: Invalid input: Unexpected end of file (2.100) 2025-11-01 08:56:05.318850+00:00at Sharp.toBuffer (/usr/src/app/server/node_modules/.pnpm/sharp@0.34.4/node_modules/sharp/lib/output.js:163:17) 2025-11-01 08:56:05.318859+00:00at MediaRepository.decodeImage (/usr/src/app/server/dist/repositories/media.repository.js:105:68) 2025-11-01 08:56:05.318871+00:00at MediaService.decodeImage (/usr/src/app/server/dist/services/media.service.js:177:59) 2025-11-01 08:56:05.318889+00:00at process.processTicksAndRejections (node:internal/process/task_queues:105:5) 2025-11-01 08:56:05.318901+00:00at async MediaService.generateImageThumbnails (/usr/src/app/server/dist/services/media.service.js:190:44) 2025-11-01 08:56:05.318910+00:00at async MediaService.handleGenerateThumbnails (/usr/src/app/server/dist/services/media.service.js:116:25) 2025-11-01 08:56:05.318926+00:00at async JobService.onJobRun (/usr/src/app/server/dist/services/job.service.js:199:30) 2025-11-01 08:56:05.318938+00:00at async EventRepository.onEvent (/usr/src/app/server/dist/repositories/event.repository.js:91:13) 2025-11-01 08:56:05.318946+00:00at async /usr/src/app/server/node_modules/.pnpm/bullmq@5.61.2/node_modules/bullmq/dist/cjs/classes/worker.js:528:32 ``` ### Additional information Other photos taken at the same time, of the same things, with the same camera, do not have this issue. Only certain photos at seemingly random times encounter this.
Author
Owner

@bo0tzz commented on GitHub (Nov 1, 2025):

Gwenview, it also cannot open this specific broken HEIC file

Input file has corrupt header:

Sounds like it's just broken? What do you expect Immich to do here?

@bo0tzz commented on GitHub (Nov 1, 2025): > Gwenview, it also cannot open this specific broken HEIC file > Input file has corrupt header: Sounds like it's just broken? What do you expect Immich to do here?
Author
Owner

@hasmar04 commented on GitHub (Nov 2, 2025):

@bo0tzz I should have made it clearer.
If I send the photo over to my phone and open it in Samsung Gallery or Google Photos (as a local file), it opens fine. So it's not completely corrupted (if file corruption is the problem.

@hasmar04 commented on GitHub (Nov 2, 2025): @bo0tzz I should have made it clearer. If I send the photo over to my phone and open it in Samsung Gallery or Google Photos (as a local file), it opens fine. So it's not completely corrupted (if file corruption is the problem.
Author
Owner

@skatsubo commented on GitHub (Nov 2, 2025):

Right, not completely corrupted, not well formed either.
I tried to generate thumbnail for your corrupted sample with env var IMMICH_PROCESS_INVALID_IMAGES=true https://docs.immich.app/install/environment-variables/#general - no luck.
Immich uses sharp -> libvips -> libheif for image processing. If they can't handle it, then not much can be done on Immich side.
You can try re-saving those images using an external editor.

@skatsubo commented on GitHub (Nov 2, 2025): Right, not completely corrupted, not well formed either. I tried to generate thumbnail for your corrupted sample with env var `IMMICH_PROCESS_INVALID_IMAGES=true` https://docs.immich.app/install/environment-variables/#general - no luck. Immich uses sharp -> libvips -> libheif for image processing. If they can't handle it, then not much can be done on Immich side. You can try re-saving those images using an external editor.
Author
Owner

@hasmar04 commented on GitHub (Nov 2, 2025):

That's a shame. There are quite a few photos (potentially 100+) affected by this, so was hoping for something a little more automated, but Ah well.
Yes, converting them to jpeg in Samsung Gallery (which is able to open the broken heic files) is a solution, and then immich is able to process them successfully.

@hasmar04 commented on GitHub (Nov 2, 2025): That's a shame. There are quite a few photos (potentially 100+) affected by this, so was hoping for something a little more automated, but Ah well. Yes, converting them to jpeg in Samsung Gallery (which is able to open the broken heic files) is a solution, and then immich is able to process them successfully.
Author
Owner

@TerMorab commented on GitHub (Nov 3, 2025):

Hi,
I am facing issues the same way as @hasmar04 does. From my large store of pictures, that I'm managing with Immich from my galaxy phone, I found, since the update to the immich version above 2.0.x, that a bunch of photos would not generate thumbnails any more. But for no reason, other did. Same format (haic, jpg, jpeg, png), same phone, same app for uploading.
But what I figured out is, it looks like not format specific but a question of the size of the image.

Trying to upload a pic of the size 9 MP / 4000 x 2252 / 2,9 MiB / heic (from the web view of immich) does lead to no thumbs, no matter, if you try to create thumbs of webp or jpeg or if you manually try to recreate thumbs.
But going on the phone and resizing the same image to 6 MP / 3200 x 1800 / 1,9 MiB / heic, uploading it to immich and let the thumbs generate, will do the trick. The thumbs are there, no errors showing up.

Not sure if it comes from the ration or the whole size of the images, it is reproducible.

Hope that helps in any matter. If needed, I can provide a set of images for reproduction.

@TerMorab commented on GitHub (Nov 3, 2025): Hi, I am facing issues the same way as @hasmar04 does. From my large store of pictures, that I'm managing with Immich from my galaxy phone, I found, since the update to the immich version above 2.0.x, that a bunch of photos would not generate thumbnails any more. But for no reason, other did. Same format (haic, jpg, jpeg, png), same phone, same app for uploading. But what I figured out is, it looks like not format specific but a question of the size of the image. Trying to upload a pic of the size 9 MP / 4000 x 2252 / 2,9 MiB / heic (from the web view of immich) does lead to no thumbs, no matter, if you try to create thumbs of webp or jpeg or if you manually try to recreate thumbs. But going on the phone and resizing the same image to 6 MP / 3200 x 1800 / 1,9 MiB / heic, uploading it to immich and let the thumbs generate, will do the trick. The thumbs are there, no errors showing up. Not sure if it comes from the ration or the whole size of the images, it is reproducible. Hope that helps in any matter. If needed, I can provide a set of images for reproduction.
Author
Owner

@TerMorab commented on GitHub (Nov 3, 2025):

A bit more of findings to the size:
Working size:
1816 x 4032
3968 x 2232
2268 x 4032
4032 x 2268

not working:
4032 x 1816

That's the only size, where I see no thumbs generated for. But because I changed my phone lately, the standard size comes with 4032 x 1816 and makes a whole mess.

@TerMorab commented on GitHub (Nov 3, 2025): A bit more of findings to the size: Working size: 1816 x 4032 3968 x 2232 2268 x 4032 4032 x 2268 not working: 4032 x 1816 That's the only size, where I see no thumbs generated for. But because I changed my phone lately, the standard size comes with 4032 x 1816 and makes a whole mess.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#7692