immich icon indicating copy to clipboard operation
immich copied to clipboard

[BUG] Files deleted outside the app result in broken image

Open Sherlock1979 opened this issue 1 year ago • 9 comments

The bug

When I have a backed up asset on my mobile phone (cloud with check mark) and I delete it outside of Immich (e.g. with a file manager) then the Immich app shows a broken image.

Expected behaviour: image becomes "cloud only" and icon changes accordingly (cloud icon without check mark)

The OS that Immich Server is running on

Ubuntu 22.04

Version of Immich Server

1.56.0

Version of Immich Mobile App

1.55.0

Platform with the issue

  • [ ] Server
  • [ ] Web
  • [X] Mobile

Your docker-compose.yml content

Irrelevant

Your .env content

Irrelevant

Reproduction steps

1. Take a photo and create an Immich backup. Ensure you have a cloud with check mark icon.
2. Delete the photo on your phone using a file manager.
3. Refresh the timeline in Immich.

Additional information

No response

Sherlock1979 avatar May 19 '23 23:05 Sherlock1979

Can you try update the app to the same version with the server to see if the issue persist? Also try pull to refresh the timeline as well

alextran1502 avatar May 19 '23 23:05 alextran1502

Can you try update the app to the same version with the server to see if the issue persist? Also try pull to refresh the timeline as well

Checked with 1.56.1.

Same problem.

Sherlock1979 avatar May 20 '23 02:05 Sherlock1979

How about logout and then login again?

alextran1502 avatar May 20 '23 03:05 alextran1502

That's interesting. When I click 'Sign Out', the app (Android) does not sign me out but starts 'Building the timeline' which it does not finish even after several minutes, so I need to swipe out the app to get it closed. I think it is actually another bug. Do you want me to open another issue?

Once I signed out and swiped out the app, then I need to log in (so I guess it did sign me out anyways. And after logging back in, everything is fine. So there is no broken image and the small icon is a blank cloud (as it was supposed to be). So you were right, signing out and signing back in solves the problem. But I think it is still not the desired behaviour, right?

Sherlock1979 avatar May 20 '23 04:05 Sherlock1979

1.57.1 same behaviour. Logging out and in fixes it but pull refresh does not.

Sherlock1979 avatar May 24 '23 20:05 Sherlock1979

I can not reproduce the error. What I did / how it turned out:

  1. Take a new picture.
  2. Background upload makes a backup
  3. Open Immich, see picture has cloud with checkmark
  4. Open native file app and delete that picture on device
  5. Open Immich: Initially, that picture had the cloud with checkmark. After 1-2 seconds, it changes to cloud (no checkmark)

I guess, we need some more details (and app logs) to figure out your issue.

fyfrey avatar May 25 '23 12:05 fyfrey

Thanks for looking into it .

In step 5, do you do anything when it changes to cloud? Like pull to refresh or force quit?

I tried to wait but nothing changed. Pull to refresh did not help either

Sherlock1979 avatar May 25 '23 20:05 Sherlock1979

The key difference is background sync. I don't have that turned on.

Now I turned it on and the cloud icon changed just as you described.

But using only manual sync (without background sync and foreground sync), my steps can reproduce the bug.

Sherlock1979 avatar May 25 '23 20:05 Sherlock1979

I tried but again could not reproduce the issue (neither foreground nor background sync was enabled). Can you provide the logs (profile drawer, logs, share in the top right) of the app here after you encounter the issue?

fyfrey avatar May 30 '23 17:05 fyfrey

I ran into a very similar issue, hope these steps to repeat provide useful info:

  1. On mobile (Android), copy one or more photos to a new album.
  2. Add this album as a backup album.
  3. Confirm Immich uploaded the photo(s).
  4. Outside Immich, delete all photos in the album that was just created.
  5. In my case, refreshing immich worked, but killing the app and reopening before the updates kick in created broken images (all black with a slashed image icon).

Enabling Prefer remote images (and refreshing) shows the image, but it was still registered as cloud and local. Logging out and back in again fixes the afflicted images.

server: 1.69.0 app: 1.68.0 build 91

Gorkycreator avatar Jul 24 '23 14:07 Gorkycreator

Enabling Prefer remote images (and refreshing) shows the image, but it was still registered as cloud and local. Logging out and back in again fixes the afflicted images.

This solved it for me, since they were showing on the web but not on the app. Thanks!

d3vv3 avatar Jul 30 '23 09:07 d3vv3

I'm on iOS and just saw this issue as well. I do not have background or foreground sync turned on and after running a manual backup I deleted the images using the native photos app. When I returned to Immich this caused my photos and thumbnails to be broken until I logged out and back in to Immich. The couch and checkmark icon were on the broken images, so it appears Immich thinks these image are still on the device.

Does Immich check if local assets are still present when the app is launch or pull down refresh action is taken? I couldn't seem to get it to work until I logged out and back in (which caused my timeline to get re-built and causes quite a delay within the app as I have > 100K photos backed up on my server.

Running Immich app version 1.76.0 and server 1.76.1

VenomousViper27 avatar Sep 06 '23 19:09 VenomousViper27

Hello is this issue still relevance? if not, can you help me close it?

alextran1502 avatar Nov 01 '23 04:11 alextran1502

Hello is this issue still relevance? if not, can you help me close it?

Hi Alex, I changed the way I use Immich so I cannot test this scenario any more. I hope others have more valuable input to this. Otherwise, can be closed.

Sherlock1979 avatar Nov 01 '23 05:11 Sherlock1979

I got the same issue how could I help?

yodatak avatar Nov 01 '23 12:11 yodatak

@yodatak You could provide the app log exported as CSV directly after you encountered the issue and describe in a few steps what you did to trigger the issue. Please, also describe whether you use iOS or Android, how you selected your backup albums (e.g. only Recents, individual albums, excluded albums etc.). Thank you!

fyfrey avatar Nov 01 '23 13:11 fyfrey

Hello is this issue still relevance? if not, can you help me close it?

Hi Alex, I changed the way I use Immich so I cannot test this scenario any more. I hope others have more valuable input to this. Otherwise, can be closed.

How do you use not now? I'm curious because I back up pics from phone to Immich then delete from phone. So I have this same problem with the way I use it. Dodntou find a better way?

Sevyn13 avatar Nov 01 '23 17:11 Sevyn13

Hello is this issue still relevance? if not, can you help me close it?

Hi Alex, I changed the way I use Immich so I cannot test this scenario any more. I hope others have more valuable input to this. Otherwise, can be closed.

How do you use not now? I'm curious because I back up pics from phone to Immich then delete from phone. So I have this same problem with the way I use it. Dodntou find a better way?

I upload the photos to the server with a different tool and then use the CLI to add the photos to Immich. This was I can freely delete photos on my phone as I wish without interfering with my Immich library.

Sherlock1979 avatar Nov 01 '23 18:11 Sherlock1979

What tool do you use to go from phone to server?

Sevyn13 avatar Nov 01 '23 19:11 Sevyn13

What tool do you use to go from phone to server?

Foldersync

Other considerations can be Syncthing, Resilio Sync, RoundSync. Each has its own pros and cons...

Sherlock1979 avatar Nov 01 '23 19:11 Sherlock1979

I'm experiencing the same issue. Deleting a file from device but keeping it in the remote backup results in a broken image icon in the Immich app. Logging out and in again resolves the issue until another file is deleted.

I've noticed a small spinner next to the photos icon in the bottom bar. I don't know what activity it is supposed to indicate, but it's constantly spinning at all times and therefore maybe related to this issue?

I'm also seeing a lot of the following log entries:

Catch all error: PathNotFoundException: Cannot retrieve length of file, path = '/private/var/mobile/Containers/Data/Application/37E8F17F-786C-461B-9FE0-3285AC35EF63/tmp/.image/D6574BD9-5305-435F-9F46-1737AF95B415_L0_001_0.000000_o_IMG_2526.HEIC' (OS Error: No such file or directory, errno = 2) - PathNotFoundException: Cannot retrieve length of file, path = '/private/var/mobile/Containers/Data/Application/37E8F17F-786C-461B-9FE0-3285AC35EF63/tmp/.image/D6574BD9-5305-435F-9F46-1737AF95B415_L0_001_0.000000_o_IMG_2526.HEIC' (OS Error: No such file or directory, errno = 2)

and

Catch all error:  - PlatformException(asset is not found, null, null, null) - image resource service - resolving an image codec - #0      StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:652)
#1      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:310)
<asynchronous suspension>
#2      AssetEntityImageProvider._loadAsync.<anonymous closure> (package:photo_manager/src/internal/image_provider.dart:132)
<asynchronous suspension>

I'm using Immich server 1.88.2 and Immich iOS 1.88.0 build.128.

A1bi avatar Nov 25 '23 12:11 A1bi

Same issue om Android.

File deleted from device still showing as broken image in immich app.

Logout and then login again starts rebuilding timeline and fixed the issue. Another way to rebuild the timeline may be sufficient (eg as option I'm settings)

Note that the deleted images where in a folder that I used to set as a backup folder and then removed, bit the images stayed in the library. As there is no good way to select a lot of images at once I removed them from device...

Version 1.97 build 125

arnelap avatar Mar 03 '24 18:03 arnelap

+1 and the problem is actually worse... Opening a removed file in the Android app deletes it from the cloud.

Details:

1- My phone and cloud were in sync. 2- I deleted the images folder from the phone (using File Explorer on Android) 3- I opened the Immich app 4- It was still showing the tick inside the cloud but no thumbnail 5- I clicked on a couple videos (with no thumbnail) 6- the videos I clicked on got deleted from the cloud 7- Restored the deleted folder from the trash 8- Logged out and back in to Immich Android app 9- Immich did not detect what was already synced and what was not, it reported that the whole folder needs to be uploaded 10- Background sync uploaded the whole folder (that was previously deleted and then restored) again

mdafer avatar May 18 '24 02:05 mdafer

@mdafer Which phone model are you using? Do you mind recording a screen capture and sharing it here so I can try to reproduce what you are seeing?

alextran1502 avatar May 18 '24 03:05 alextran1502

@alextran1502 I will post a video (gif) shortly, but here's some more details:

  • Phone model is Samsung A71 SM-A715W
  • When I deleted the folder locally, the Backup and Total statistics in the Backup View on the Android app went down from 1100+ to 704, even though only 3 files were deleted from the cloud (after I accessed them from the mobile app)
  • After I reuploaded the whole folder again using the Android app, the Backup statistics did not change (still 704), and the 3 files that were deleted from the cloud are still not showing up neither on Mobile nor Web
  • I suspect that it has something to do with "Repair", but repair doesn't work either, it just keeps loading, in the network tab it shows that "report" ajax request is pending, but it stays pending forever (I already applied the documented reverse-proxy configuration)

I will post a video of what I did, but the results may not be the same as the changes seem to be permanent for now...

mdafer avatar May 18 '24 16:05 mdafer

@mdafer can you create a test account on your instance and create a sample local maybe around 10 test asset to perform the reproduction of the error? That would be easier to follow and manage

alextran1502 avatar May 18 '24 16:05 alextran1502

Ah sure, I forgot that deduplication doesn't work across accounts... I'm on it

mdafer avatar May 18 '24 16:05 mdafer

@alextran1502 I'm unable to reproduce the issue unfortunately. One thing I noticed though is that the issue happened on server version 1.105.0, while now I'm using 1.105.1. If this is a known issue of the previous version then I'm very sorry for wasting your time... Otherwise, the issue remains a mystery. And, on that account, I'm still unable to retrieve/upload the lost files, they are being considered as duplicates (I've already checked the trash and they're not there).

mdafer avatar May 18 '24 18:05 mdafer

@mdafer try to go into App Setting > Advanced > remote duplicate database and try again

alextran1502 avatar May 18 '24 18:05 alextran1502

@alextran1502

  • In the Android app I clicked: Settings -> Advanced -> Clear Duplicated Assets
  • It detected the whole folder that I previously deleted and caused this issue, statistics went back to 1118 (which is correct before that bug happened)
  • It re-uploaded the files in the folder, but once it was done, nothing had changed. Also, the backup statistics in the Android app are back to 704.
  • The 3 files that were deleted as a result of the bug are still being considered as duplicate whenever I reupload them, even though I can't find them anywhere in Immich

mdafer avatar May 18 '24 20:05 mdafer