Unofficial archive. This is a read-only, community-run archive of the Apple Support Community. It is not affiliated with or endorsed by Apple Inc.

Photos not showing up anymore in a specific smart album that should show all photos that are not in any album

Hello there.

I had a smart album. Configuration: "Album is not in any". This showed me all photos that are not in any album. Like this I am able to keep a good overview about which photos I have not sorted.

I created a new album and accidentally selected all photos that were in that smart album. This was not my intention so I pressed 'command + z' (reverting the creation of the album).

My expectation: The smart album should show all photos again like it was before the creation of the album. Because now - after the 'command + z' (deleting the album) - the photos are again in no album.


However, the photos are not in the Smart Album anymore. I can still see them when looking at all photos, however like this it is merely impossible for me to sort because I can't say which photos are not in an album already...


Anyone knows what I could do?


I already did a repair of the database from photos which did not help.


Best Regards,

Dave

32 replies

I can confirm that it is still buggy, even for new photo libraries.

  • As a test, I created a new library with just one photo
  • and created a top level album with the photo,
  • I created two smart albums, one with "Album is Any", one with "Album is not Any". The result looked good - "Album is Any" had one photo, "Album is not Any" was empty.


  • Now I deleted the Test Album. The smart albums did not update, even after restarting Photos . Really weird to be seeing "Album is Any" with one photo and "Album is not Any" emppty, if there is no album at all.
  • The old work-around is still working. If I duplicate the photo and delete the original, the smart albums are back to normal for the duplicates. Only the thumbnails of the albums do not update, but the numbers of photos are correct.

I mentioned it in the comment in the script, that we should select the photos in App Photos.

But the code is barely readable in the code insertion window.

I'll post a copy of the script in the User Tip section. There we can post longer text with a better formatting and add updates.

Script: Find Photos not in Any Album, for… - Apple Community


As a test launch exporter the original of one of the problem images to the desktop. Open it with Preview or a 3rd party image editor and save under a different file name. Import that and see if it will duplicate. If that works with only a few to contend with the problem should be behind you rather quickly.

Which dot release of Catalina are you running? Some of the users here have noticed a bug in Catalina that shows up similar to what you describe. If an album is deleted while it contains photos, those photos never get back into the "in no album" state (whether it's a count or a flag), breaking smart albums to detect unfixed photos. It is not unreasonable to think this bug could also be triggered by cmd-Z on album creation.


I do not know if anybody has tested the very newest Catalina 10.15.5 (with Photos Version 5.0 (151.19.150)) to see if it still has the bug.


I am unaware of any way to fix the photos affected by the bug other than restoring the whole library from a backup taken before the deletion of the non-empty album.

I have no idea, Dave. It will run a very, very long time because of the changes in Catalina. Just to create the list of all albums is now taking hours. I could finish my income tax declaration while waiting for the script to create the list of all albums and folders.

Let it run over night.


It would really be easier to simply add a keyword "in_Album" to each photo in an album. We can easily select all photos in an album with ⌘A and then type the keyword into the Info. Then we can use a smart album "keyword is ...".


Thanks - this workaround can be a little labourious, but it works. I have about 15000 photos to place in folders so after adding the Keyword 'In-Album' to all existing pics in albums I went through the whole new Smart Album, (Keyword > is not > In_Album), and stuck to adding to only 2 Albums. After this I added the Keyword to all the pics in these 2 Albums, and when I opened the Smart Album again, there were about 1200 fewer pics in there. Bingo!

And thanks again Leonie.

Yes, GMG_Consulting, it did work at some point and now doesn't work for any photos that were in albums at the time the albums were deleted (under certain Catalina releases). Photos has lost track of how many albums those photos are in. User léonie has outlined above the only know recovery method, which is going to be painful if all of your photos are affected.

None of the older scripts that we published for finding the album a photo is in, is working right now with Photos 5 on catalina.

In particular this phrase:

set names to name of (albums whose id of media items contains pictureId)


We can no longer simply request Photos to return a list of all albums containing a certain picture or even a list of all albums, including the albums in folders. We have to write a recursive loop to collect all albums inside a folder, then recursively do the same for all subfolders. It is tedious and slow as molasses.

I tried to write a script to find all albums o photo is in, that would work on my Photos Library - it took hours to run: see

I gave up on scripting albums for the time being, after writing these two scripts: These scripts can give an idea, how to check all photos for the album they are in. It is messy.

I modified my version of Jacques Rioux's script to search all albums and folders. It is working for my smal test library with 30 images, but I have not tested it on my main library with thousand albums and 50000 images.



The result for the small test library:

There is a big difference here: I was searching for only one photo, not the whole Library, which could easily account for lengthy searches.


My search was needed because one of my Smart Albums was not showing the expected results of photos not being in an Album. I couldn't find which Albums they were in. However, since playing around with Léonie's script, the problem seems to have gone away. Could the search have reset a flag somewhere? I don't know.


Hope this helps.

Stephen

Version: 10.15.5 ( 00004000 19F96) - so just updated it today. However, the bug is still there.

My Apps are also Up-To-Date.

Is there a script that might identify the missing photos?


I will try to create a smart album in another way now...

Wonderful, thank you very much for your fast reply.

Hey, Léoni, I took a script from you and adapted it. I am not really sure if it works since I am not used to Apple Script language.

I think the script could solve the problem instantly: My Goal with the script:

  1. Get all photos that are currently NOT in any album (I tried with another script => the photos not showing in the smart album are detected with a script)
  2. Put all these photos in an new album


=> When I have this, I can export all these photos from that album, delete the originals and re-import and the problem should be solved.

What do you think?


I attached the script I adapted from you - not sure if it works at the moment, but if you would have time, it would be nice if you could have a look at it and give me some feedback.


Best Regards,

Dave


Thank you very much for your response.

Hmm that is unfortunate, that such things are not available anymore.


So my script would be 'correct', but the specific line 'set names to name of (albums whose id of media items contains pictureId)' is not valid anymore?


And rewriting it quickly is not possible as much as I understand?


I mean I don't care if it takes 10 days until the process is finished --- in the end without a script I will have no chance to find out which photos are not in any album at the moment.


Or do you have any other suggestions?


Best Regards,

Dave



Ah and BTW: I tried out the script from Jacques Rioux's => It works for me, that it can tell me in which albums a photo is (given that I put it in a toplevel album).

That is why I don't understand, why my script shouldn't work?

I mean it is exactly the same syntax: set names to name of (albums whose id of media items contains pictureId) - or what am I missing?

Are you getting any error message on your Library, or what is the problem, when you are runing your script?


This phrase is now only checking top level albums: (albums whose id of media items contains pictureId)

It will not help, if you are having albums in nested folders.



Thank you, Léonie, that script is very helpful. It works fine on my Library of c. 13,000 photos and 84 Albums.


It might be worth mentioning that it doesn't work from within a Smart Album, only when the picture in All Photos is selected. That's probably obvious to some, but it wasn't to me.

Hei there,

thank you very much. I am running the script - already since 6 hours - I don't know if this is working or not --- in my test photo library it worked for 5 photos.


Do you have any idea how long it could take for 10'000 photos and about 60 albums?


My albums folder is structured like the following (with folders and albums - but just 1 level deep)


Albums

2010 (folder)

album 1

album 2

2011 (folder)

album 1

etc.


thank you very much for your help!

Best Regards,

Dave

Hei there!

Sounds great. Then I will let it run over night and if that does not work I will follow the idea with the keyword - sounds like a much easier solution in the end!


Thx a lot for that idea!

Best Regards,

Dave

Hi Dave, see my reply above. It ran on my Library in less than five minutes for c. 13,000 photos, 85 Albums and 20-odd folders. I'm running Catalina 10.15.5 on a 1 TB SSD. Also, the other script to produce a list of Albums and Folders ran even quicker.


Is there something else going on?


Stephen

Hey there. That is good to know - than something is definitely wrong here - at least for my computer :-)

I also have Catalina 10.15.5 && 1TB SSD.


I wouldn't know what is going on - it just seems to be stuck (the script). So I select all photos in the main photos library and then I run the script. I will try once more and if that does not succeed in the first 5-10 minutes, I will try the other solution from Léoni!


It is this script: Script: Find Photos not in Any Album, for… - Apple Community right?


Best Regards,

Dave

So after 30 minutes of adding keywords I am finally finished. Thank you very much for the tip - it worked like a charm, and I have all photos that were lost to the current bug in photos.


Best Regards,

Dave

I was wrong - the problem has not gone away. So I have resorted to following the user tip mentioned by Old Toad and prepared by Léonie. I applied the process by year and I've successfully completed 2000 to 2014, but something odd is now happening.


Having gathered the 2015 photos in the '__NotInAnyAlbum' album, duplicating them has stopped working properly. Initially, I tried selecting all the pictures, which has worked for previous years but they failed to duplicate. Testing various approaches, I found that selecting a reduced number worked for a while and I have been duplicating, deleting and removing 15 at a time. But the number I can do this with gradually reduces, until only one at a time is possible.


The error sometimes results in the app not doing anything, sometimes the 'Duplicating' progress bar shows but then disappears at the end without duplicating photos, and sometimes the progress bar appears fleetingly after which nothing happens. In testing, I have restarted the app and the machine, I have left it alone for a significant time to see whether I'm just impatient, and I have rerun the searching script. The latter seems to help a little, but the problem soon recurs. I've even upgraded my iCloud storage, although it had 7GB free space, in case the synchronisation was struggling. The problem is not confined to one Mac, either.


Has anyone any idea what's happening, please?


TIA

Stephen

I have found what was causing the duplication process to fail. I'll explain it here in case it helps with anyone esle's problems


When selecting a collection of photos and trying to duplicate them, if the collection contains one photo that won't duplicate then none of them will. So selecting the whole album failed, but repeatedly selecting, say, the first 20 would work until a photo that won't duplicate gets into that group, in which case the first 20 won't duplicate. Reducing the size of the group gradually to one then identifies an individual photo that won't duplicate. Remove that photo and repeat.


Doing this for about 2,000 photos revealed about 14 that will not duplicate whatever I try. I kept 11 of these to review and I can't see much commonailty between them.

  • They're all in 2015, but that's the album I was working with. I haven't found a similar problem in any other year so far.
  • All but one are from the same camera, but that's mine so hardly surprising.
  • They have all been edited, but so have many others in the album.
  • There is a range of different types of views - scenes, interior, close up - so nothing seems peculiar to these.


So I have a few photos that were corrupting the 'duplicate then delete' process for fixing the 'in album' bug, but I have no idea what has corrupted those photos that causes them to be incapable of duplication.


Regards all,

Stephen

Thanks, OT, a good idea that I had not thought of.


In fact, I've fixed them by a very simple process of removing the editing and reverting to the original. This works even when I go in to edit an affected photo, click 'Revert to Original', immediately re-edit, then click 'Done'. The resulting photo can be duplicated.


Presumably there was something in the original editing that corrupted the photos, although I can't think that I did anything differently to these compared to all the others.


Anyway, thank for everyone's help.

Stephen

When you say "the bug is still there," do you mean that you can damage new photos the same way after the update, or just that the previously damaged photos stay damaged?

Sorry, I missed that bit! Thanks for all the work.


Stephen

That is good to know, Stephen.

My library is an iCloud Library. Perhaps that is making a difference.

And the folders are nested deeply.


Great 😊 You're welcome.


I had a smart album. Configuration: "Album is not in any". This showed me all photos that are not in any album. Like this I am able to keep a good overview about which photos I have not sorted.


I created 20 smart albums (by year) and moved these smart albums into the respective "year folders" when moving the folders the photos were removed from smart album "Album is not in any". after this step there were 0 photos in the "Album is not in any". smart album


I decided the smart album by year was not granular enough, deleted the smart albums and when I checked the "Album is not in any" smart folder they did not re-appears within that folder. This is very similar to the experience DanteToTheK. I am not into running scripts to fix this problem.


I am running Catalina 10.15.5 with my photos library on a samsung T5 2GB drive. I have done a repair on the library, no change. I deleted and recreated the smart album "Album is not in any", no change. I went and deleted any albums that I created, no change. So at this point I would assume using "Album is not in any" would show all of my photos in "Album is not in any". It still shows 0 files in "Album is not in any", but does show ALL the photos as "Album is in Any".


This did work at some point and now it doesn't.


First part of script:

set dialogResult to display dialog ¬
	"Enter the file size threshold for small photos or videos in kB : " buttons {"Cancel", "OK"} ¬
	default answer (defaultFileSizeThreshold as text)
set FileSizeThresholdkB to (text returned of dialogResult) as integer -- file size in kB
set FileSizeThreshold to FileSizeThresholdkB * 1024 -- file size in Byte




set photosNotInAnyAlbumName to "photosNotInAnyAlbum" -- the album to collect all photos not in any album


tell application "Photos"
	activate
	-- Ensure that the albums do exist
	try
		set imageSel to (get selection)
	on error errTexttwo number errNumtwo
		display dialog "Cannot get the selection: " & errNumtwo & return & errTexttwo
	end try
	--	return the size of the first item of imageSel
	
	try
		if not (exists container photosNotInAnyAlbumName) then
			make new album named photosNotInAnyAlbumName
		end if
		set theAlbumWithPhotosNotInAnyAlbum to container photosNotInAnyAlbumName
		
		if not (exists container "SkippedPhotos") then
			make new album named "SkippedPhotos"
		end if
		set theSkippedAlbum to container "SkippedPhotos"
		
		
	on error errTexttwo number errNumtwo
		display dialog "Cannot open albums: " & errNumtwo & return & errTexttwo
	end try
	
	
	-- process the selected photos from the All Photos album
	
	set photosNotInAnyAlbum to {} -- the list of small photos	
	
  • -- check, if the album o

Second part of the script: - Sorry was not possible in any other way... :-(

if imageSel is {} then
		error "Please select some images."
	else
		repeat with im in imageSel
			try
				tell im --get the file size
					set pictureId to its id
					set names to name of (albums whose id of media items contains pictureId)
				end tell
			on error errText number errNum
				display dialog "Error: " & errNum & return & errText & "Trying again"
				try
					delay 2
					tell im
						set pictureId to its id
						set names to name of (albums whose id of media items contains pictureId)
					end tell
				on error errTexttwo number errNumtwo
					display dialog "Skipping image due to repeated error: " & errNumtwo & return & errTexttwo
				end try
			end try
			set inNoAlbum to (names is missing value)
			if inNoAlbum then
				set photosNotInAnyAlbum to {im} & photosNotInAnyAlbum
			end if
		end repeat
		add photosNotInAnyAlbum to theAlbumWithPhotosNotInAnyAlbum
		return "Photos not in any album: " & (length of photosNotInAnyAlbum)
	end if
end tell