Impossible to access Nextcloud conf panel: illegal environment variable name

What type of hardware are you using: Other(?)
What YunoHost version are you running: 12.0.11
What app is this about: Nextcloud

Describe your issue

When I try to access the Nextcloud conf panel (either by the yunohost admin panel or with sudo yunohost app config get nextcloud) I get the following message:

Traceback (most recent call last):
  File "/usr/bin/yunohost", line 108, in <module>
    main()
  File "/usr/bin/yunohost", line 97, in main
    yunohost.cli(
  File "/usr/lib/python3/dist-packages/yunohost/__init__.py", line 41, in cli
    ret = moulinette.cli(
          ^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/moulinette/__init__.py", line 140, in cli
    ).run(args, output_as=output_as, timeout=timeout)
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/moulinette/interfaces/cli.py", line 521, in run
    ret = self.actionsmap.process(args, timeout=timeout)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/moulinette/actionsmap.py", line 579, in process
    return func(**arguments)
           ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yunohost/app.py", line 1866, in app_config_get
    return config_.get(key, mode)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yunohost/utils/configpanel.py", line 478, in get
    self.config, self.form = self._get_config_panel(prevalidate=False)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yunohost/utils/configpanel.py", line 806, in _get_config_panel
    config, raw_settings = self._get_partial_raw_settings_and_mutate_config(config)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yunohost/utils/configpanel.py", line 757, in _get_partial_raw_settings_and_mutate_config
    raw_settings = self._get_raw_settings()
                   ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yunohost/app.py", line 1899, in _get_raw_settings
    return self._call_config_script("show")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yunohost/app.py", line 1960, in _call_config_script
    ret, values = hook_exec(config_script, args=[action], env=app_script_env)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yunohost/hook.py", line 409, in hook_exec
    returncode, returndata = _hook_exec_bash(
                             ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/yunohost/hook.py", line 476, in _hook_exec_bash
    returncode = call_async_output(command, loggers, shell=False, cwd=chdir, env=_env)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/moulinette/utils/process.py", line 100, in call_async_output
    p = subprocess.Popen(args, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 1024, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.11/subprocess.py", line 1820, in _execute_child
    raise ValueError("illegal environment variable name")
ValueError: illegal environment variable name

It happened after I put my nextcloud in maintenance mode to switch hard drive (only user data, no conf here, also still happening when I put the old drive back) and rebooted. In between the last two reboots, according to the logs, I ran regen ssh, regen dovecot and regen dsnmasq, and two updates regarding php packages.

Apparently I also run into the same error when I try to backup nextcloud.

For more information, I run yunohost at home on a Gigabyte GB-BACE-3150 (rev. 1.0).

I really need to get out of the maintenance mode soon at least.

Thank you for your help!

Share relevant logs or error messages

Nextcloud change config log: https://paste.yunohost.org/raw/iwedonamaf
Backup log: https://paste.yunohost.org/raw/irekiguyiw