immich icon indicating copy to clipboard operation
immich copied to clipboard

External Libraries: Offline Assets are deleted right away instead of getting moved to Trash

Open Salvoxia opened this issue 7 months ago • 3 comments

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

  • [x] Yes

The bug

This relates to #17290 / #17300. When assets in an external library are no longer accessible to Immich, the expectation is for Immich to mark these assets as "offline" and move them to the trash. If access is restored, Immich should restore them from the trash as well.

This no longer works as of v1.131.x. Now, when Immich loses access to an asset in an external library, that asset is removed from the database immediately. It no longer shows up in trash.

The OS that Immich Server is running on

Docker

Version of Immich Server

v1.131.3

Version of Immich Mobile App

N/A

Platform with the issue

  • [x] Server
  • [ ] Web
  • [ ] Mobile

Your docker-compose.yml content

Does not apply

Your .env content

Does not apply

Reproduction steps

  1. Mount and create an external library with at least one asset and let Immich import the library
  2. Make sure the asset shows up in Immich Timeline
  3. Delete the asset from the external library mount
  4. The asset is not longer visible in Immich Timeline
  5. The asset is not found in Trash either

Relevant log output

[Nest] 7  - 04/06/2025, 8:50:13 AM   DEBUG [Microservices:LibraryService] File unlink event received for /mnt/hdd1/ImmichTest/AVM3/IMG_0785.JPG in library 40e9f94e-8f67-4312-ad9b-5a6813625833}
[Nest] 7  - 04/06/2025, 8:50:13 AM VERBOSE [Microservices:LibraryService] Deleting asset(s) /mnt/hdd1/ImmichTest/AVM3/IMG_0785.JPG from library 40e9f94e-8f67-4312-ad9b-5a6813625833

Additional information

I can confirm that this issue can be reliably reproduced with Immich v1.130.x as well as v1.131.x. It seems to have been introduced with v1.130.0, since v1.129.0 works as expected. Hope that helps tracking down the issue in the codebase.

Log Output when deleting a file in Immich Server v1.129.0 looks like this:

[Nest] 7  - 04/06/2025, 9:07:55 AM   DEBUG [Microservices:LibraryService] Asset is no longer on disk or is inaccessible because of permissions, removing: /mnt/hdd1/ImmichTest/AVM3/IMG_0785.JPG

Salvoxia avatar Apr 06 '25 09:04 Salvoxia

Can you help capture your trash settings in Administration > Settings > Trash Settings

Image

alextran1502 avatar Apr 07 '25 15:04 alextran1502

Absolutely:

Image

Salvoxia avatar Apr 07 '25 18:04 Salvoxia

I'm using version 134 and similar thing happened to me. But after re-mounting the shared drive and re-scanning the external library, all files reappeared without the need of doing facial recognition and all metadata computing, miniature generation etc.

So I assume this is fixed now?

What is the expected behavior? Would these files go to trash and disappear after 30 days if I don't re-mount and re-scan the external library?

klinki avatar Jun 12 '25 18:06 klinki

I just tested this. Created a library and scanned it - the photos show up. Deleted/moved a few files out of the library folder and rescanned - the photos show up in the trash now. Restored/copied the files back and scanned again - the photos show up in the timeline again. Seems to be working as expected.

jrasm91 avatar Sep 19 '25 00:09 jrasm91