Photos and Memories lose all albums content

I have now contacted both the maintainer of Nextcloud-AIO and Nextcloud-Memories, and have been suggested to seek help here.

The issue you are facing:

I have a dedicated server, on which I run Nextcloud AIO, Photos, recognize and Memories. In general all works well.

We create a lot of albums in Memories.
All our media is stored on a 2 different NAS, and the folder(s) is mounted into Nextcloud via the External Folders Feature.

I mount the folders via /etc/fstab entry and use SMB/CIFS. The files paths, Never change.

This is the second time it happens, that we have accessed memories, and while I see all the albums, they have ZERO pictures/content in it.
Since files get added externally, I have a periodic cron jobs running Nextcloud files scan, and also memories Index (below).

*/10 * * * * docker ps --format "{{.Names}}" | grep -q "^nextcloud-aio-nextcloud$" && docker exec --user www-data nextcloud-aio-nextcloud php occ files:scan --all
*/15 * * * * docker ps --format "{{.Names}}" | grep -q "^nextcloud-aio-nextcloud$" && docker exec --user www-data nextcloud-aio-nextcloud php occ memories:index

Everything is connected via lan and 10G switches, My initial guess was, it could be that if there is an intermittent network disconnection Photos/Memories loses all album info, but I can see all photos and videos in the Timeline.

I am thinking that may be if the nextcloud files:scan -all runs when the network is down, then it removes files, and when they get readded the fileid changes and therefore I lose all media in Albums?

But the thing is, when i ssh into the server and looked into the server and mounted folder, it did not give me erros like
- stale file handles, that happens when accessing a mounted folder after network disconnect.

Memories Maintainers view was that -all should not cause entries to disappear.
Do you think this is normal? will removing -all from files:scan help? Or is there something else i can do?

I don’t experience this issue on a Photoprism instance using the same media repository. (Unused for a while since I moved to Photos/Memories)

Ref chat with Pulsejet:
pulsejet/memories#1287

Also, noticed that all face recognition data is gone as well.

Error i saw is below.
Shows when accessing empty album in Photos, but shows when accessing in Memories.

<html>
<body>
<!--StartFragment-->
Error | index | ExceptionOCA\Photos\Album\AlbumFile::__construct(): Argument #2 ($name) must be of type string, null given, called in /var/www/html/apps/photos/lib/Album/AlbumMapper.php on line 250 in file '/var/www/html/apps/photos/lib/Album/AlbumFile.php' line 32
-- | -- | --


<!--EndFragment-->
</body>
</html>

[/details]
Nextcloud AIO v9.5.1
Nextcloud version (eg, 29.0.5): 29.0.6.1
Operating system and version (eg, Ubuntu 24.04): Ubuntu Server 22.04
Apache or nginx version (eg, Apache 2.4.25): AIO+Nginx-Proxy-Manager
PHP version (eg, 8.3): As with AIO

Is this the first time you’ve seen this error? (Y/N): Second time

Steps to replicate it:

  1. It’s happened 2nd time in 6 months. I am not sure how to replicate it.

The output of your Nextcloud log in Admin > Logging:

{"reqId":"pehGXv4Du8E6nX4F1bkV","level":3,"time":"2024-09-15T18:35:53+00:00","remoteAddr":"192.168.50.1","user":"bisu","app":"index","method":"GET","url":"/apps/photos/api/v1/preview/15723900?x=512&y=512","message":"OCA\\Photos\\Album\\AlbumFile::__construct(): Argument #2 ($name) must be of type string, null given, called in /var/www/html/apps/photos/lib/Album/AlbumMapper.php on line 250 in file '/var/www/html/apps/photos/lib/Album/AlbumFile.php' line 32","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36","version":"29.0.6.1","exception":{"Exception":"Exception","Message":"OCA\\Photos\\Album\\AlbumFile::__construct(): Argument #2 ($name) must be of type string, null given, called in /var/www/html/apps/photos/lib/Album/AlbumMapper.php on line 250 in file '/var/www/html/apps/photos/lib/Album/AlbumFile.php' line 32","Code":0,"Trace":[{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Photos\\Controller\\PreviewController"],"index"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":331,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Photos\\Controller\\PreviewController","index",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["15723900","photos.preview.index"]]},{"file":"/var/www/html/lib/base.php","line":1058,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/photos/api/v1/preview/15723900"]},{"file":"/var/www/html/index.php","line":49,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","Line":170,"Previous":{"Exception":"TypeError","Message":"OCA\\Photos\\Album\\AlbumFile::__construct(): Argument #2 ($name) must be of type string, null given, called in /var/www/html/apps/photos/lib/Album/AlbumMapper.php on line 250","Code":0,"Trace":[{"file":"/var/www/html/apps/photos/lib/Album/AlbumMapper.php","line":250,"function":"__construct","class":"OCA\\Photos\\Album\\AlbumFile","type":"->","args":[0,null,null,0,0,null,1724410830,"bisu"]},{"file":"/var/www/html/apps/photos/lib/Controller/PreviewController.php","line":150,"function":"getForAlbumIdAndFileId","class":"OCA\\Photos\\Album\\AlbumMapper","type":"->","args":[57,15723900]},{"file":"/var/www/html/apps/photos/lib/Controller/PreviewController.php","line":114,"function":"getFileIdForAlbums","class":"OCA\\Photos\\Controller\\PreviewController","type":"->","args":[15723900,[["OCA\\Photos\\Album\\AlbumInfo"]]]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":232,"function":"index","class":"OCA\\Photos\\Controller\\PreviewController","type":"->","args":[15723900,512,512]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":138,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Photos\\Controller\\PreviewController"],"index"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[["OCA\\Photos\\Controller\\PreviewController"],"index"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":331,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Photos\\Controller\\PreviewController","index",["OC\\AppFramework\\DependencyInjection\\DIContainer"],["15723900","photos.preview.index"]]},{"file":"/var/www/html/lib/base.php","line":1058,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/photos/api/v1/preview/15723900"]},{"file":"/var/www/html/index.php","line":49,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/apps/photos/lib/Album/AlbumFile.php","Line":32},"message":"OCA\\Photos\\Album\\AlbumFile::__construct(): Argument #2 ($name) must be of type string, null given, called in /var/www/html/apps/photos/lib/Album/AlbumMapper.php on line 250 in file '/var/www/html/apps/photos/lib/Album/AlbumFile.php' line 32","exception":[],"CustomMessage":"OCA\\Photos\\Album\\AlbumFile::__construct(): Argument #2 ($name) must be of type string, null given, called in /var/www/html/apps/photos/lib/Album/AlbumMapper.php on line 250 in file '/var/www/html/apps/photos/lib/Album/AlbumFile.php' line 32"},"id":"66e7291292559"}
1 Like

Hi, Bumping the post. In case anyone has any suggestrions or feedback.

1 Like

Right now the same happened to me.
I still need to analyze it.

But just want to say you are not alone

2 Likes

Hi,

Thanks for letting me know. Please do let me know what your finding are. For now, I have stopped using nextcloud for photos due to this problem.

1 Like

Hello, same problem here.
I also have CIFS shares, 10gb network.
All of a sudden the last month of photos disappeared from Memories, in the timeline and in the albums.
The albums are still here but empty. I added my last pic yesterday evening, everything was fine, then I went to bed. Now I just woke up and pics are gone from Memories and Photos. I had a message saying something like “error while loading photos”. But my log is empty except this :

Capabilities of OCA\GroupFolders\AppInfo\Capabilities took 1.5 seconds to generate.

Hi all,

I’m experiencing what looks like exactly the same problem. I’m not sure what caused it - I’ve recently had a hardware failure which forced me to move NC to a new machine. Whilst everything else (except for sharing tracks in Phonetrack) is now working well again, my albums all have 0 photos in them, in both Photos and Memories.

I know the files themselves still exist, and I can browse them in both apps, and in Files.

Errors in the log look like:

{“reqId”:“TrIZHx2aqOg5gnTN0Dkb”,“level”:3,“time”:“2025-01-21T18:37:51+00:00”,“remoteAddr”:“192.168.1.64”,“user”:“ian”,“app”:“index”,“method”:“GET”,“url”:“/apps/photos/api/v1/preview/307217?x=512&y=512”,“message”:“OCA\Photos\Album\AlbumFile::__construct(): Argument #2 ($name) must be of type string, null given, called in /var/www/nextcloud/apps/photos/lib/Album/AlbumMapper.php on line 235 in file ‘/var/www/nextcloud/apps/photos/lib/Album/AlbumFile.php’ line 17”,“userAgent”:“Mozilla/5.0 (X11; Linux x86_64; rv:133.0) Gecko/20100101 Firefox/133.0”,“version”:“30.0.5.1”,“exception”:{“Exception”:“Exception”,“Message”:“OCA\Photos\Album\AlbumFile::__construct(): Argument #2 ($name) must be of type string, null given, called in /var/www/nextcloud/apps/photos/lib/Album/AlbumMapper.php on line 235 in file ‘/var/www/nextcloud/apps/photos/lib/Album/AlbumFile.php’ line 17”,“Code”:0,“Trace”:[{“file”:“/var/www/nextcloud/lib/private/AppFramework/App.php”,“line”:161,“function”:“dispatch”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:“->”},{“file”:“/var/www/nextcloud/lib/private/Route/Router.php”,“line”:302,“function”:“main”,“class”:“OC\AppFramework\App”,“type”:“::”},{“file”:“/var/www/nextcloud/lib/base.php”,“line”:1003,“function”:“match”,“class”:“OC\Route\Router”,“type”:“->”},{“file”:“/var/www/nextcloud/index.php”,“line”:24,“function”:“handleRequest”,“class”:“OC”,“type”:“::”}],“File”:“/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php”,“Line”:146,“Previous”:{“Exception”:“TypeError”,“Message”:“OCA\Photos\Album\AlbumFile::__construct(): Argument #2 ($name) must be of type string, null given, called in /var/www/nextcloud/apps/photos/lib/Album/AlbumMapper.php on line 235”,“Code”:0,“Trace”:[{“file”:“/var/www/nextcloud/apps/photos/lib/Album/AlbumMapper.php”,“line”:235,“function”:“__construct”,“class”:“OCA\Photos\Album\AlbumFile”,“type”:“->”},{“file”:“/var/www/nextcloud/apps/photos/lib/Controller/PreviewController.php”,“line”:133,“function”:“getForAlbumIdAndFileId”,“class”:“OCA\Photos\Album\AlbumMapper”,“type”:“->”},{“file”:“/var/www/nextcloud/apps/photos/lib/Controller/PreviewController.php”,“line”:97,“function”:“getFileIdForAlbums”,“class”:“OCA\Photos\Controller\PreviewController”,“type”:“->”},{“file”:“/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php”,“line”:208,“function”:“index”,“class”:“OCA\Photos\Controller\PreviewController”,“type”:“->”},{“file”:“/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php”,“line”:114,“function”:“executeController”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:“->”},{“file”:“/var/www/nextcloud/lib/private/AppFramework/App.php”,“line”:161,“function”:“dispatch”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:“->”},{“file”:“/var/www/nextcloud/lib/private/Route/Router.php”,“line”:302,“function”:“main”,“class”:“OC\AppFramework\App”,“type”:“::”},{“file”:“/var/www/nextcloud/lib/base.php”,“line”:1003,“function”:“match”,“class”:“OC\Route\Router”,“type”:“->”},{“file”:“/var/www/nextcloud/index.php”,“line”:24,“function”:“handleRequest”,“class”:“OC”,“type”:“::”}],“File”:“/var/www/nextcloud/apps/photos/lib/Album/AlbumFile.php”,“Line”:17},“message”:“OCA\Photos\Album\AlbumFile::__construct(): Argument #2 ($name) must be of type string, null given, called in /var/www/nextcloud/apps/photos/lib/Album/AlbumMapper.php on line 235 in file ‘/var/www/nextcloud/apps/photos/lib/Album/AlbumFile.php’ line 17”,“exception”:{},“CustomMessage”:“OCA\Photos\Album\AlbumFile::__construct(): Argument #2 ($name) must be of type string, null given, called in /var/www/nextcloud/apps/photos/lib/Album/AlbumMapper.php on line 235 in file ‘/var/www/nextcloud/apps/photos/lib/Album/AlbumFile.php’ line 17”}}

same problem. How should I solve this problem?