Login "Could not load 'user' service" for users with Email 2FA; TOTP users are ok

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • assoclip
    Junior Member
    • Apr 2026
    • 6

    #1

    Login "Could not load 'user' service" for users with Email 2FA; TOTP users are ok



    Hi,

    After upgrading to 10.1.1 (CLI upgrade, from [previous version]), regular users who use Email 2FA can no longer log in. The login form shows "Internal server error. Check logs for details." Users with TOTP 2FA, including my admin, can still log in. Upgrading to 10.1.2 didn't change the issue.

    **Environment**
    - EspoCRM 10.1.2, upgraded via CLI (php command.php upgrade)
    - PHP 8.4, MariaDB 11.4.12, shared hosting (cPanel)
    - No custom code related to authentication: custom/ contains only entity/entry point customizations; no custom containerServices, authentication hooks or middleware (checked with grep)
    - Relevant config:
    'authenticationMethod' => 'Espo'
    'auth2FA' => true
    'auth2FAForced' => true
    'auth2FAMethodList' => ['Totp', 'Email']
    'auth2FAInPortal' => false

    **What happens**
    - Entering valid username/password for an Email-2FA user shows the "Internal server error" toast on the login screen.
    - data/logs/espo-YYYY-MM-DD.log shows, for each attempt:

    CRITICAL: (0) Could not load 'user' service. :: GET /App/user
    RuntimeException(code: 0): Could not load 'user' service. at .../application/Espo/Core/Container.php:353

    (the log does not include a stack trace)
    - The server error_log is empty.

    **Observations**
    - A TOTP user (regular, non-admin) logs in normally.
    - My admin account (TOTP) logs in normally.
    - Users configured with Email 2FA fail (at least two different accounts tested, incl. the one used in the screenshot).
    - I did not test users without 2FA configured, with the forced-2FA setup flow.
    - Setting auth2_f_a = 0 in user_data for an affected Email-2FA user (with auth2FAForced disabled) restores login immediately, which confirms the failure is specific to the Email 2FA login path.

    **What I tried (no change)**
    - php rebuild.php
    - php clear_cache.php
    - OPcache reset by cycling PHP version in cPanel (8.4 → 8.3 → 8.4)

    **Hypothesis (unconfirmed)**
    Since the Email method sends the code right after the first factor, before the user is set in the container, some class involved in that step may now depend on the current user ('user' service), which isn't available at that point. I have not been able to confirm this; I'll add a stack trace as soon as I have one.
    ​

    Is this a known issue in 10.1.x? Any pointer on what changed in the Email 2FA login path (or in how 'user' is registered in the container during the 2FA step) would help.

    Thanks.
    Last edited by assoclip; Today, 09:10 AM.
  • yuri
    EspoCRM product developer
    • Mar 2014
    • 10119

    #2
    Thank you for reporting.

    Original report: https://forum.espocrm.com/forum/bug-reports/128630-login-could-not-load-user-service-for-users-with-email-2fa-totp-users-are-ok EspoCRM version 10.1.0-10.1.2

    Comment

    Working...