Skip to content

setup.py add-user fails with AttributeError: 'PgAdmin' object has no attribute 'login_manager' #10124

Description

@ashirmustafa

Environment:

  • pgAdmin 4: Latest version bundled with PostgreSQL 18
  • PostgreSQL: 18
  • OS: Windows 11

Issue:
When attempting to create a user using the CLI command:

setup.py add-user

the command fails with the following exception:

AttributeError: 'PgAdmin' object has no attribute 'login_manager'

Traceback excerpt:

ManageUsers.create_user()
-> ManageRoles.get_role()
-> create_app()
-> delete_adhoc_servers()
-> current_user
-> current_app.login_manager._load_user()

AttributeError: 'PgAdmin' object has no attribute 'login_manager'

Expected behavior:

  • The add-user command should create a new pgAdmin user successfully.

Actual behavior:

  • The command crashes before the user is created.

Notes:

  • This occurs on a fresh installation using the latest pgAdmin version.
  • The issue appears to happen during application initialization when delete_adhoc_servers() accesses current_user before login_manager has been initialized.
  • pgAdmin itself is installed correctly; the failure occurs specifically in the CLI user-management path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions