I just started self-hosting my own Nextcloud instance and am once again marveling at the beauty of NixOS. However, when I try to enable the passwords app via the web panel or the nextcloud-occ command, I receive a “500 Internal Server Error” response. Other apps work without a problem. Here are my journalctl logs:
Jul 12 22:16:47 myhostname Nextcloud[1325]: {"reqId":"iC4m8zhqdVXwKhXJ1091","level":3,"time":"2025-07-12T22:16:47+00:00","remoteAddr":"2a02:2455:8254:b000:ff29:4400:a022:69f9","user":"god","app":"PHP","method":"GET","url":"/apps/dashboard/","message":"Cannot redeclare nix_decode_json_file() (previously declared in /nix/store/lp6a3s7gyqi1c1f7rynp52fc7p8q92rb-nextcloud-config.php:3) at /nix/store/lp6a3s7gyqi1c1f7rynp52fc7p8q92rb-nextcloud-config.php#3","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0","version":"31.0.6.2","data":{"app":"PHP"}}
Jul 12 22:16:47 myhostname nginx[1446]: 2025/07/12 22:16:47 [error] 1446#1446: *591 FastCGI sent in stderr: "PHP message: PHP Fatal error: Cannot redeclare nix_decode_json_file() (previously declared in /nix/store/lp6a3s7gyqi1c1f7rynp52fc7p8q92rb-nextcloud-config.php:3) in /nix/store/lp6a3s7gyqi1c1f7rynp52fc7p8q92rb-nextcloud-config.php on line 3" while reading response header from upstream, client: 2a02:2455:8254:b000:ff29:4400:a022:69f9, server: cloud.my-domain.de, request: "GET /apps/dashboard/ HTTP/2.0", upstream: "fastcgi://unix:/run/phpfpm/nextcloud.sock:", host: "cloud.my-domain.de"
Jul 12 22:16:58 myhostname systemd[1]: Starting nextcloud-cron.service...
Jul 12 22:16:58 myhostname systemd[1]: Started nextcloud-cron.service.
Jul 12 22:16:58 myhostname nextcloud-cron-start[7785]: PHP Fatal error: Cannot redeclare nix_decode_json_file() (previously declared in /nix/store/lp6a3s7gyqi1c1f7rynp52fc7p8q92rb-nextcloud-config.php:3) in /nix/store/lp6a3s7gyqi1c1f7rynp52fc7p8q92rb-nextcloud-config.php on line 3
While in theory it should be fine to use the app store, this opens up potential for nextcloud to screw things up. Could you try, for the sake of argument, to use the declarative app install?
Note that you can also use nixos-rebuild build-vm to build a VM you can run locally.
Fair enough, guess there’s not much to do but debug the actual nextcloud config. Can you have a read through/share the various nextcloud config files (notably /nix/store/lp6a3s7gyqi1c1f7rynp52fc7p8q92rb-nextcloud-config.php)?
I’d build your system and try it out myself, but I’m without a computer for the moment.
I tried using Nextcloud 30 instead of 31 and got the same result. I did not see any changes to the configuration files when I enabled or disabled the app, but I might have missed them. Only the database changes. Here is the configuration you asked for.
Probably. It strikes me as odd that an app would trigger this. But it doesn’t look like anything is outright wrong. I suspect you’ll still have to do the debugging yourself, in either case.
I read your ticket on GitHub… I’m relieved that I’m not facing an unsolvable problem. For now, we have to wait, but a solution seems possible.
One last thing you didn’t mention. For users who already have passwords, the problem doesn’t occur.
So on my instance, I have users for whom it works perfectly and others who are stuck with a 500 error.