# Nextcloud passwords crashes the server dramatically

**URL:** https://discourse.nixosstag.fcio.net/t/nextcloud-passwords-crashes-the-server-dramatically/66517
**Category:** Help
**Created:** [July 12, 2025, 10:40pm UTC](https://discourse.nixosstag.fcio.net/t/nextcloud-passwords-crashes-the-server-dramatically/66517 "2025-07-12T22:40:21Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Headfridge](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/headfridge/32/33206_2.png) [@Headfridge](https://discourse.nixosstag.fcio.net/u/Headfridge)
#### Post date: [July 12, 2025, 10:40pm UTC](https://discourse.nixosstag.fcio.net/t/nextcloud-passwords-crashes-the-server-dramatically/66517/1 "2025-07-12T22:40:21Z")

</div>

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:

```auto

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

```

It works again after disabling it.

It seems this problem has been around for some time now.  
Here is a review of the Passwords app: [Passwords - Apps - App Store - Nextcloud](https://apps.nextcloud.com/apps/passwords)  
Here is a question from the French forum: [[Nextcloud] Erreur = Cannot redeclare nix\_decode\_json\_file()](https://discourse.nixosstag.fcio.net/t/nextcloud-erreur-cannot-redeclare-nix-decode-json-file/63857)

If you cannot help me here, where should I open an issue ticket? Should I do so in nixpkgs or nextcloud-passwords? …or both?

Thanks for your help!

---

<div class="post-metadata">

### Author: ![TLATER](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/tlater/32/4257_2.png) [@TLATER](https://discourse.nixosstag.fcio.net/u/TLATER)
#### Post date: [July 12, 2025, 11:42pm UTC](https://discourse.nixosstag.fcio.net/t/nextcloud-passwords-crashes-the-server-dramatically/66517/2 "2025-07-12T23:42:21Z")

</div>

Can you share your configuration? This looks like some messy state shenanigans, looks like your `nextcloud-config.php` is executed twice?

---

<div class="post-metadata">

### Author: ![Headfridge](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/headfridge/32/33206_2.png) [@Headfridge](https://discourse.nixosstag.fcio.net/u/Headfridge)
#### Post date: [July 13, 2025, 12:54am UTC](https://discourse.nixosstag.fcio.net/t/nextcloud-passwords-crashes-the-server-dramatically/66517/3 "2025-07-13T00:54:01Z")

</div>

Thank you for your reply! I have dumbed down my original config and redacted my personal info here: [nixos-config\_copy/zeuss/configuration.nix at master · L-Zach/nixos-config\_copy · GitHub](https://github.com/L-Zach/nixos-config_copy/blob/master/zeuss/configuration.nix)

Tested it with a fresh reinstall on a hetzner cloud server and the issue persists.

---

<div class="post-metadata">

### Author: ![TLATER](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/tlater/32/4257_2.png) [@TLATER](https://discourse.nixosstag.fcio.net/u/TLATER)
#### Post date: [July 13, 2025, 7:35am UTC](https://discourse.nixosstag.fcio.net/t/nextcloud-passwords-crashes-the-server-dramatically/66517/4 "2025-07-13T07:35:04Z")

</div>

You’re leaking your password into the nix store here: [nixos-config\_copy/zeuss/configuration.nix at master · L-Zach/nixos-config\_copy · GitHub](https://github.com/L-Zach/nixos-config_copy/blob/master/zeuss/configuration.nix#L86)

This here is what I was wondering about: [nixos-config\_copy/zeuss/configuration.nix at master · L-Zach/nixos-config\_copy · GitHub](https://github.com/L-Zach/nixos-config_copy/blob/master/zeuss/configuration.nix#L99)

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?

> [@Headfridge](#):
>
> Tested it with a fresh reinstall on a hetzner cloud server

Note that you can also use `nixos-rebuild build-vm` to build a VM you can run locally.

---

<div class="post-metadata">

### Author: ![Headfridge](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/headfridge/32/33206_2.png) [@Headfridge](https://discourse.nixosstag.fcio.net/u/Headfridge)
#### Post date: [July 13, 2025, 11:53am UTC](https://discourse.nixosstag.fcio.net/t/nextcloud-passwords-crashes-the-server-dramatically/66517/5 "2025-07-13T11:53:38Z")

</div>

Using `fetchNextcloudApp` yields the same error. I tried it with both stable and unstable nixpkgs.

```auto
    extraApps = {
      passwords = pkgs.fetchNextcloudApp {
        appName = "passwords";
        appVersion = "2025.7.0";
        hash = "sha256-SVItAtFRO/CbZ203ZS86inCZ+ZpGy0NUS3y2Xj1b+LI=";
        license = "agpl3Plus";
        url = "https://git.mdns.eu/api/v4/projects/45/packages/generic/passwords/2025.7.0/passwords.tar.gz";
      };
    };
    extraAppsEnable = true;

```

Thanks for pointing out my leaking password and the `nixos-rebuild build-vm` command. I am still a beginner when it comes to Nix.

---

<div class="post-metadata">

### Author: ![TLATER](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/tlater/32/4257_2.png) [@TLATER](https://discourse.nixosstag.fcio.net/u/TLATER)
#### Post date: [July 13, 2025, 1:27pm UTC](https://discourse.nixosstag.fcio.net/t/nextcloud-passwords-crashes-the-server-dramatically/66517/6 "2025-07-13T13:27:37Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Headfridge](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/headfridge/32/33206_2.png) [@Headfridge](https://discourse.nixosstag.fcio.net/u/Headfridge)
#### Post date: [July 14, 2025, 4:03am UTC](https://discourse.nixosstag.fcio.net/t/nextcloud-passwords-crashes-the-server-dramatically/66517/7 "2025-07-14T04:03:02Z")

</div>

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.

```auto
<?php

function nix_decode_json_file($file, $error) {
  if (!file_exists($file)) {
    throw new \RuntimeException(sprintf($error, $file));
  }
  $decoded = json_decode(file_get_contents($file), true);

  if (json_last_error() !== JSON_ERROR_NONE) {
    throw new \RuntimeException(sprintf("Cannot decode %s, because: %s", $file, json_last_error_msg()));
  }

  return $decoded;
}
$CONFIG = [
  'apps_paths' => [
    ['path' => '/nix/store/bbq2m3bzi7i8lpgf6jjf2c3j0zbgywvl-nextcloud-31.0.6-with-apps/apps', 'url' => '/apps', 'writable' => false],
['path' => '/nix/store/bbq2m3bzi7i8lpgf6jjf2c3j0zbgywvl-nextcloud-31.0.6-with-apps/store-apps', 'url' => '/store-apps', 'writable' => true],

  ],
  'appstoreenabled' => true,
  'memcache.local' => '\OC\Memcache\APCu',
  'dbname' => 'nextcloud',
  'dbhost' => '/run/postgresql',
  'dbuser' => 'nextcloud',
  
  
  'dbtype' => 'pgsql',
  
];

$CONFIG = array_replace_recursive($CONFIG, nix_decode_json_file(
  "/nix/store/jmnb1qr7q8b99fivqa8vwh11v0is4r2n-nextcloud-settings.json",
  "impossible: this should never happen (decoding generated settings file %s failed)"
));

```

Opening an issue ticket in nixpkgs would be okay now, right?

---

<div class="post-metadata">

### Author: ![TLATER](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/tlater/32/4257_2.png) [@TLATER](https://discourse.nixosstag.fcio.net/u/TLATER)
#### Post date: [July 14, 2025, 9:31am UTC](https://discourse.nixosstag.fcio.net/t/nextcloud-passwords-crashes-the-server-dramatically/66517/8 "2025-07-14T09:31:17Z")

</div>

> [@Headfridge](#):
>
> Opening an issue ticket in nixpkgs would be okay now, right?

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.

---

<div class="post-metadata">

### Author: ![Headfridge](https://discourse.nixosstag.fcio.net/user_avatar/discourse.nixosstag.fcio.net/headfridge/32/33206_2.png) [@Headfridge](https://discourse.nixosstag.fcio.net/u/Headfridge)
#### Post date: [July 14, 2025, 11:17am UTC](https://discourse.nixosstag.fcio.net/t/nextcloud-passwords-crashes-the-server-dramatically/66517/9 "2025-07-14T11:17:54Z")

</div>

> <https://github.com/NixOS/nixpkgs/issues/425060>
>
> \### Nixpkgs version
> 
> \- Stable (25.05)
> 
> \### Describe the bug
> 
> Attempting to open …the dashboard or passwords app yields a \`500 Internal Server Error\` message.
> 
> \### Steps to reproduce
> 
> 1. Install and enable the \[passwords app\](https://apps.nextcloud.com/apps/passwords) app with either the Apps Dashboard or the \`fetchNextcloudApp\` function.
> 2. Open the passwords app or the dashboard.
> 
> 
> \### Expected behaviour
> 
> Working and accessible passwords app.
> 
> \### Screenshots
> 
> \_No response\_
> 
> \### Relevant log output
> 
> \`\`\`console
> Jul 12 22:16:47 myhostname Nextcloud\[1325\]: {"reqId":"iC4m8zhqdVXwKhXJ1091","level":3,"time":"2025-07-12T22:16:47+00:00","remoteAddr":"myip","user":"root","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: myip, 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
> \`\`\`
> 
> \### Additional context
> 
> I tried enabling it without success using 
> \- webinterface and \`fetchNextcloudApp\`
> \- stable 25.05 and unstable 25.11
> \- nextcloud30 and nextcloud31
> 
> Manually disabling passwords using the \`nextcloud-occ\` command fixes the crashing dashboard.
> More context is available on \[Discourse\](https://discourse.nixosstag.fcio.net/t/nextcloud-passwords-crashes-the-server-dramatically/66517).
> 
> \### System metadata
> 
> - system: \`"aarch64-linux"\`
> - host os: \`Linux 6.12.37, NixOS, 25.05 (Warbler), 25.05.20250710.10e6872\`
> - multi-user?: \`yes\`
> - sandbox: \`yes\`
> - version: \`nix-env (Nix) 2.28.4\`
> - nixpkgs: \`/nix/store/f4989aa56frar4hhr107kg3dxmvv4g9h-source\`
> 
> \### Notify maintainers
> 
> @bachp 
> @britter 
> @dotlambda 
> @Ma27 
> @provokateurin 
> \---
> 
> \*\*Note for maintainers:\*\* Please tag this issue in your pull request description. (i.e. \`Resolves #ISSUE\`.)
> 
> 
> \### I assert that this issue is relevant for Nixpkgs
> 
> \- \[x\] I assert that this is a bug and not a support request.
> \- \[x\] I assert that this is not a \[duplicate of an existing issue\](https://github.com/NixOS/nixpkgs/issues?q=is%3Aopen+is%3Aissue+label%3A%220.kind%3A+bug%22+label%3A%226.topic%3A+nixos%22). 
> \- \[x\] I assert that I have read the \[NixOS Code of Conduct\](https://github.com/NixOS/.github/blob/master/CODE\_OF\_CONDUCT.md) and agree to abide by it.
> 
> \### Is this issue important to you?
> 
> Add a :+1: \[reaction\] to \[issues you find important\].
> 
> \[reaction\]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
> \[issues you find important\]: https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc

---

<div class="post-metadata">

### Author: ![Mimoza](https://discourse.nixosstag.fcio.net/letter_avatar_proxy/v4/letter/m/c2a13f/32.png) [@Mimoza](https://discourse.nixosstag.fcio.net/u/Mimoza)
#### Post date: [July 25, 2025, 7:58pm UTC](https://discourse.nixosstag.fcio.net/t/nextcloud-passwords-crashes-the-server-dramatically/66517/10 "2025-07-25T19:58:04Z")

</div>

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.

Wait & See
