George Garside Blog

A place of many ramblings about macOS and development. If you find something useful on here, it's probably an accident.

This is a fairly common error taking many forms, shown when opening a photos library with the Photos app. Your library is most likely still intact and your photos still stored safely. Just because Photos can’t automatically repair the library on launch doesn’t mean it is unrecoverable. Here's some steps you can take to recover your photos.

Photos library could not be opened

The library could not be opened.
Photos has attempted to repair the library Photos Library.photoslibrary but is unable to open it.

The most common cause of this is a permissions problem. Not necessarily that you don't have the permission, as Photos will prompt for administrator permissions if that's simply the case, but that permissions can't be obtained, even with administrator. For example, if the library is open elsewhere: on another Mac on the network, for example.

If that didn’t fix it for you, you can manually try repairing the library. If it’s a permissions problem, Photos.app doesn’t like to ask for administrator privileges automatically, instead just saying that Photos attempted to repair the library but is unable to open it without actually trying to repair it. You can force Photos to try to repair the library by holding ⌥option and ⌘command whilst launching Photos. Photos.app will try to repair the library and it may ask you for administrator privileges.

Photos library could not be created

Photos could not upgrade your library because it is on an unsupported disk volume

This error is likely due to an incorrect partition format, such as NTFS which can't be written to. Photos requires write permission to create a library or to migrate a library from iPhoto. You can fix this by copying the library to somewhere where you can write to, such as your ~/Pictures directory — the default location for photos in your home folder.

Using Console.app for error research

For more information on an error message shown in Photos like this, open Console.app, in /Applications/Utilities/ and search for “photo”, perhaps choosing Process for this search. This can be extremely telling in what the problem is. For example, in my case, the important lines here is that photolibraryd “failed to open library” with an error message:

photolibraryd: Failed to open library Photos Library.photoslibrary Error: Error Domain=com.apple.lithium Code=54 “locked by remote host” UserInfo=0x7fafbbb48d90 {NSURL=file:///Volumes/Server/Shared%20Folders/Photos/Photos%20Library.photoslibrary/database/metaSchema.db.lock, NSLocalizedDescription=locked by remote host, NSLocalizedFailureReason=locked by host georgegarside.com}

The important content here is why the library failed to open. Here, the problem is that the library is “locked by remote host” which means that the library is open somewhere else on the network, as specified by the NSLocalizedDescription. The NSLocalizedFailureReason also includes the hostname of the Mac on the network which has locked the library—in this case, the device with the hostname of georgegarside.com. If you find that messages in the Console are hidden as <private>, you may need to set the Console privacy level to see private logs.

The solution to this issue: close Photos.app on the other Mac, or open a different library on that Mac if there are multiple libraries available.

Console.app Photos.app

Leave a Reply

2

Option 1 (Photos library could not be opened) worked and repaired/unlocked my photo album.

Many thanks.

CL

Reply
1

I am getting the same thing... I tried force repairing but getting the same error at 5%

Reply
0

Hello I have the same issue since upgrading to Catalina. Photos is trying to open the Library on NAS then repairing it and at the end (100%) is returning an error.

my Console log is:

2020-03-27 11:19:40.539 (NSOperationQueue 0x7fe768609e20 (QOS: UTILITY)) MigrationOperation.m:259 Failed to migrate the library for state MigrationStateResourceMigration and original library url: file:///Volumes/photo/Antima%20NAS.photoslibrary/. Error: Error Domain=NSCocoaErrorDomain Code=513 "“thumbs” couldn’t be removed because you don’t have permission to access it." UserInfo={NSUserStringVariant=(

Remove

), NSFilePath=/Volumes/photo/Antima NAS.photoslibrary/resources/derivatives/thumbs, NSUnderlyingError=0x7fe76873b6d0 {Error Domain=NSPOSIXErrorDomain Code=66 "Directory not empty"}}

2020-03-27 11:19:40.540 (NSOperationQueue 0x7fe768609e20 (QOS: UTILITY)) MigrationOperation.m:319 Transitioned to state: MigrationStateError

2020-03-27 11:19:41.166 (NSOperationQueue 0x7fe768609e20 (QOS: UTILITY)) MigrationOperation.m:319 Transitioned to state: MigrationStateReport

2020-03-27 11:19:41.167 (NSOperationQueue 0x7fe768609e20 (QOS: UTILITY)) MigrationOperation.m:892 Migration completion for url file:///Volumes/photo/Antima%20NAS.photoslibrary/

2020-03-27 11:19:41.167 (NSOperationQueue 0x7fe768609e20 (QOS: UTILITY)) MigrationOperation.m:894 Task completion summary: MigrationStateStart - 0.000176 sec progress: 0/100 (0.00 %)

2020-03-27 11:19:41.167 (NSOperationQueue 0x7fe768609e20 (QOS: UTILITY)) MigrationOperation.m:894 Task completion summary: MigrationStateOptionsCheck - 124.080324 sec progress: 1/100 (1.00 %)

2020-03-27 11:19:41.167 (NSOperationQueue 0x7fe768609e20 (QOS: UTILITY)) MigrationOperation.m:894 Task completion summary: MigrationStateResourceMigration - 3.737296 sec progress: 78/100 (78.00 %)

2020-03-27 11:19:41.167 (NSOperationQueue 0x7fe768609e20 (QOS: UTILITY)) MigrationOperation.m:894 Task completion summary: MigrationStateError - 0.623378 sec progress: 79/100 (79.00 %)

2020-03-27 11:19:46.144 (NSManagedObjectContext 0x7fe76f4ed530) MigrationOperation.m:903 Migration completion time for 38729 assets: 128.441174 sec progress: 79/100 (79.00 %)

2020-03-27 11:19:46.145 (NSOperationQueue 0x7fe768609e20 (QOS: UTILITY)) MigrationOperation.m:915 MIGRATION FAILED: File a radar on Photos Resources Migration | macOS - attach a cpldiagnostic

2020-03-27 11:19:46.202 (NSOperationQueue 0x7fe768609e20 (QOS: UTILITY)) MigrationOperation.m:916 REASON: Error Domain=com.apple.photos.error Code=46104 "(null)" UserInfo={NSUnderlyingError=0x7fe768777b60 {Error Domain=NSCocoaErrorDomain Code=513 "“thumbs” couldn’t be removed because you don’t have permission to access it." UserInfo={NSUserStringVariant=(

Remove

), NSFilePath=/Volumes/photo/Antima NAS.photoslibrary/resources/derivatives/thumbs, NSUnderlyingError=0x7fe76873b6d0 {Error Domain=NSPOSIXErrorDomain Code=66 "Directory not empty"}}}}

Reply
0

I found this article on the issue of using a NAS as I have the same problem: https://discussions.apple.com/thread/250760748

Was anyone able to get a solution to this with still using a NAS?

Thank you

Reply
0

Great article. Clearly I have much to learn. The error message is LiErrorLibraryTypeUnknown. I will continue to try to resolve this issue so I can complete migrating my iPhoto Libraries to Photos. I thank you for getting me on the right track. GM

Reply
0

Still getting error once 5% if repair is done

Reply
0

Can only repair to 5% then get get same message about being unable to open library??

Reply