Migration Microservice Error

When attempting the new migration seems like there are some issues on my end. One user successfully processed and has no images left in /UID/ all moved to a sub folder. Another user has some folders with images created under /UID/HEX but also still has some remaining items. Looking at the Microservice log I see: Seems like the migration dies after a little while at this step. (Seems like it's trying to copy a file it already copied?)
No description
15 Replies
schuhbacca
schuhbaccaOP2y ago
@amdhunter1989 Not sure if this is a similar issue you are seeing
amdhunter1989
amdhunter19892y ago
Similar, but trying to re-run the job on my end to see if I get any errors. I saw some errors here and there, but as far as I can tell the job did run. I need to do a count on the directories the job created to see how many files are actually in the dirs in trying to re-run the job I see similar errors. I did not see this type of error the first time running the job.
Nest] 7 - 10/02/2023, 8:36:18 PM ERROR [JobService] Unable to run job handler (migration/migrate-asset): Error: Destination file already exists: upload/thumbs/db461c0c-1253-4e9a-8586-39c6c2b79f3f/6c/2c/6c2c9c90-06e2-4f80-9dd2-e89309468fad.jpeg
[Nest] 7 - 10/02/2023, 8:36:18 PM ERROR [JobService] Error: Destination file already exists: upload/thumbs/db461c0c-1253-4e9a-8586-39c6c2b79f3f/6c/2c/6c2c9c90-06e2-4f80-9dd2-e89309468fad.jpeg
Nest] 7 - 10/02/2023, 8:36:18 PM ERROR [JobService] Unable to run job handler (migration/migrate-asset): Error: Destination file already exists: upload/thumbs/db461c0c-1253-4e9a-8586-39c6c2b79f3f/6c/2c/6c2c9c90-06e2-4f80-9dd2-e89309468fad.jpeg
[Nest] 7 - 10/02/2023, 8:36:18 PM ERROR [JobService] Error: Destination file already exists: upload/thumbs/db461c0c-1253-4e9a-8586-39c6c2b79f3f/6c/2c/6c2c9c90-06e2-4f80-9dd2-e89309468fad.jpeg
I am watching immich/thumbs dir, and I see the number of items in the root dropping. I am at 8k or so, started with 15k @schuhbacca how many files were left in your thumbs/UID folder? Can you re-run the job and watch the folder to see the items being moved? I am still getting errors like the above, but the job is running and moving files. Also, I am seeing the same behavior I described above in the encoded-video folder. Whereas before, i had many items still left in the encoded-video folder.
Daniel
Daniel2y ago
We've discovered that it actually is possible that there are literally thousands of thumbnails left in the folder which are actually orphaned and not being used anymore So it isn't unlikely that the job was succesful and those are just old files
amdhunter1989
amdhunter19892y ago
My second run of the job finished, and it moved most of the files. I have 241 and 583 files left. I am going to run it one more time, and see what the count is.
If these stay static this time, would it be Ok to delete the files? this is in the /thumbs/UID/ dir. Similar, but smaller number in the encoded-video dir.
Daniel
Daniel2y ago
In theory, yes. To be sure you can try to verify using https://docs.immich.app/docs/guides/database-queries that those files aren't being referenced in the DB anymore
Database Queries | Immich
Keep in mind that mucking around in the database might set the moon on fire. Avoid modifying the database directly when possible, and always have current backups.
amdhunter1989
amdhunter19892y ago
I could do that. But I don't think that querying the DB to check thousands of files would be very doable, LOL
Daniel
Daniel2y ago
Actually, DB queries are extremely fast I don't think that's an issue
schuhbacca
schuhbaccaOP2y ago
Will have to look into later tonight with some querying. But running it seems like it works. So may just be logs spamming of retrying to copy already moved assets. But will confirm later tonight.
jrasm91
jrasm912y ago
Honestly, there is a known issue with thumbnails not being cleaned up, especially for people. It is pretty safe to delete all files left after running the migration job (without errors) The thing is (worst case scenario), you just re-generate all the thumbnails from scratch and you'd be fine.
amdhunter1989
amdhunter19892y ago
I meant thousands of individual items. But it looks like it's a non issue. I will just delete them and move on and regenerate the thumbs if something is broken. I assume if a single image is broken, I can just re run the thumb generation on that single item anyway.
Daniel
Daniel2y ago
Unfortunately no, because running all missing only re-runs thumbnail gen for assets/people without a thumbnail path set in the DB. So if you were to delete a thumb that is still referenced in the DB, it wouldn't catch it I think...
amdhunter1989
amdhunter19892y ago
Gotcha. Well, after spot checking a bunch I am able to find the image I see orphaned in my library. So I think it's safe to call them orphaned and delete. Appreciate the help!
jrasm91
jrasm912y ago
you can regenreate images for a specific asset, yes. There is a job menu option in the web for that.
amdhunter1989
amdhunter19892y ago
Yup, that's what I'm referencing. Looks like it's good to go though.
Daniel
Daniel2y ago
Oh sorry for the misinformation...

Did you find this page helpful?