Issue creation is restricted on the streams_ynh

What type of hardware are you using: VPS bought online
What YunoHost version are you running: 12.1.40.1
How are you able to access your server: SSH
Are you in a special context or did you perform specific tweaking on your YunoHost instance ?: no

Describe your issue

My YunoHost server

  • Hardware: VPS bought online (OVHcloud)
  • YunoHost version: 12.1.40.1 (stable)
  • I have access to my server: Through SSH | through the webadmin
  • App: streams 26.5.3~ynh4

Description of my issue

I found a bug in the streams package and wanted to report it, but issue
creation is restricted on the streams_ynh GitHub repository (even though the
README’s “Report an issue” badge links there). Where should bugs for this
package be reported?

Short version of the bug: on a fresh install, registering the initial
account is always rejected with “The first account must be registered using
the admin email which was supplied during setup” – even with the correct
admin email. The cause is that admin_email only exists in .htconfig.php, not
in the config DB table, so the check in Account::check_admin() compares
against an empty string. Workaround that fixed it for me:

sudo -u streams__2 php util/config system admin_email admin@example.org

I have a full written analysis (root cause, code references, findings from
comparing with an older instance) ready to post wherever it’s most useful.

Share relevant logs or error messages

Install log for the affected instance (completed without errors):
https://paste.yunohost.org/raw/milasegoko
No error appears in logs for the registration rejection itself – it happens
silently in the web form; the message shown is quoted above.

Hi @parlason

Can you give some more information ?

I cannot reproduce this bug: I installed streams and created successfully the first user with the admin email.

I just noticed that the message “The first account must be registered using the admin email which was supplied during setup” pops up even though the admin email is correct and the error is actually related to the captcha.

Thanks for the interest – here’s a more detailed writeup of the problem and how we tracked it down.
The problem occurs when you want to install a second instance of Streams:

Setup

  • YunoHost 12.1.40.1 (stable) on an OVHcloud VPS

  • Two instances of the streams package on the same server:

    • streams – installed a while ago with an older package version, since upgraded to 26.5.3~ynh4, works fine

    • streams__2 – freshly installed with 26.5.3~ynh4 on the root of a dedicated subdomain.
      The install itself completed without errors.

Symptom

On the new instance, it was impossible to create the initial account. Every registration attempt on /register was rejected with:

The first account must be registered using the admin email which was supplied during setup.

This happened even when entering exactly the admin email chosen during install (typed by hand, lowercase, no autofill). Login obviously failed too, since no account existed yet – the login page just reloaded silently.

What we ruled out first

  • Wrong email / typos / case sensitivity (the check uses a strict === comparison, so we were careful)

  • register_policy – we set it to open (util/config system register_policy 1), no change

  • Captcha/ToS/incomplete form – the “phrase” check runs before the admin-email check in the code and has its own error message, so a failing captcha was not the cause

  • Hidden characters in the stored email – verified with SELECT HEX(v) ..., the value was clean

  • fail2ban lockout, stale sessions (tested in fresh private windows)

Root cause

The rejection message comes from src/Module/Register.php (~line 98). When account_total() === 0, it calls Account::check_admin($_POST), which does:

php

$admin_email = trim(get_config('system', 'admin_email', ''));
if (strlen($admin_email) && $admin_email === trim($arr['email'])) {
    return true;
}
return false;

The installer writes the admin email to .htconfig.php only:

php

App::$config['system']['admin_email'] = 'admin@example.org';

…but no corresponding row exists in the config DB table:

sudo mysql streams__2 -e "SELECT v FROM config WHERE cat='system' AND k='admin_email';"
(empty result)

So at registration time get_config() returns an empty string, strlen() is 0, and check_admin() returns false for any submitted email. Registering the initial account through the web form is therefore impossible on a fresh install.

(Confusingly, util/config system admin_email displays the correct address, because it reads the merged file+DB configuration – which sent us down the wrong track for a while.)

Fix / workaround

Writing the value explicitly into the DB config solved the issue:

sudo -u streams__2 php util/config system admin_email admin@example.org

After that, registration with the admin email succeeded, the account got admin rights as expected, and everything works normally (channel created, admin panel accessible, federation OK). We closed registration again afterwards (register_policy 0).

Additional observations

  • The same DB row is also missing on the older instance – yet its initial account was created without problems back under the earlier package version. So either the older code read/merged admin_email from .htconfig.php at registration time and the current code doesn’t, or something else changed. Existing accounts and login are unaffected on both instances.

  • This implies any fresh install of the current version (or any state where the account table is empty, e.g. after restoring to a clean state) hits this wall.

  • Possible fixes could be: the package writing admin_email into the DB config during install, or the core falling back to the file config in check_admin().

    Not sure whether this belongs in the package or upstream ( streams/streams: Decentralised personal communication system. - Codeberg.org ) – happy to report it there too if that’s the right place.

… an isolated issue? Installing a second instance works without any problems :man_shrugging:

I can’t tell. I only know what I had to do in order to be able to log in.

To be precise: the *install* completed without problems for me too – the issue only appears when registering the initial account afterwards via /register.

Did you also check the DB row (`config` → `system`/`admin_email`) on your fresh instance?

This row is indeed absent from the config table but registration works (withadmin_emailfrom .htconfig.php).

SELECT * FROM account;
account_id: 1
          account_parent: 1
 account_default_channel: 2
            account_salt: [REDACTED]
        account_password: [REDACTED]
           account_email: [REDACTED]
        account_external: 
        account_language: fr
         account_created: 2026-07-09 18:58:54
         account_lastlog: 2026-07-09 20:02:50
           account_flags: 0
           account_roles: 4096
           account_reset: 
         account_expires: 0001-01-01 00:00:00
 account_expire_notified: 0001-01-01 00:00:00
   account_service_class: 
           account_level: 0
account_password_changed: 0001-01-01 00:00:00

(same for both instances)

Thanks for checking. So the file fallback can work, which makes my case environment-dependent rather than universal. I checked one candidate on my side: file permissions are not the explanation. My .htconfig.php is owned by the app user with mode rw------- , so the app could read it. Yet every registration attempt was rejected until I wrote admin_email into the DB, after which it worked immediately. So the actual difference between our setups remains unexplained (PHP version? opcache/config caching? something in my install run?).
I’m happy to dig further if someone has an idea what to compare next. Otherwise, at least the workaround is documented here for anyone who hits the same wall.