Error: The pgAdmin 4 server could not be contacted - Mailing list pgadmin-support

From FREDDY Liévano
Subject Error: The pgAdmin 4 server could not be contacted
Date
Msg-id DB9PR10MB5307DA169E27D2C145E89C26B16F2@DB9PR10MB5307.EURPRD10.PROD.OUTLOOK.COM
Whole thread Raw
Responses Re: Error: The pgAdmin 4 server could not be contacted
List pgadmin-support
I just installed postgresql-17.0-rc1-windows-x64 on windows 11, everything seems to be ok during the installation, but when I execute the application pgAdmin 4 is sends me next error: The pgAdmin 4 server could not be contacted.

This is what I got in the log file after the error:

pgAdmin Runtime Environment
Python Path: "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\python.exe"
Runtime Config File: "C:\Users\fffff\AppData\Roaming\pgadmin4\config.json"
Webapp Path: "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgAdmin4.py"
pgAdmin Command: "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\python.exe -s C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgAdmin4.py"
Environment:
  • ALLUSERSPROFILE: C:\ProgramData
  • APPDATA: C:\Users\fffff\AppData\Roaming
  • OPENSSL_CONF: C:\Program Files\PostgreSQL\psqlODBC\etc\openssl.cnf
  • ORIGINAL_XDG_CURRENT_DESKTOP: undefined
  • OS: Windows_NT
  • Path: C:\Program Files\PostgreSQL\17\pgAdmin 4\runtime;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\Microsoft SQL Server\160\DTS\Binn;C:\Users\fffff\AppData\Local\Programs\Python\Python312-32\Scripts;C:\Users\fffff\AppData\Local\Programs\Python\Python312-32;
  • PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
  • PGADMIN_INT_KEY: 3950fd98-9f7c-458d-9702-a049f3955b12
  • PGADMIN_INT_PORT: 54847
  • PGADMIN_SERVER_MODE: OFF
  • PROCESSOR_ARCHITECTURE: AMD64
  • PROCESSOR_IDENTIFIER: Intel64 Family 6 Model 183 Stepping 1, GenuineIntel
  • PROCESSOR_LEVEL: 6
  • PROCESSOR_REVISION: b701

Total spawn time to start the pgAdmin4 server: 0.045 Sec
2024-09-23 13:30:31,853: ERROR pgadmin: Database migration failed
2024-09-23 13:30:31,855: ERROR pgadmin: Traceback (most recent call last):
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\batch.py", line 690, in drop_constraint
const = self.named_constraints.pop(const.name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'ck_port_range'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin_init_.py", line 386, in upgrade_db
db_upgrade(app)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin\setup\db_upgrade.py", line 25, in db_upgrade
flask_migrate.upgrade(migration_folder)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\flask_migrate_init_.py", line 111, in wrapped
f(*args, **kwargs)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\flask_migrate_init_.py", line 200, in upgrade
command.upgrade(config, revision, sql=sql, tag=tag)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\command.py", line 406, in upgrade
script.run_env()
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\script\base.py", line 582, in run_env
util.load_python_file(self.dir, "env.py")
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\util\pyfiles.py", line 95, in load_python_file
module = load_module_py(module_id, path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\util\pyfiles.py", line 113, in load_module_py
spec.loader.exec_module(module) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 995, in exec_module
File "", line 488, in call_with_frames_removed
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin\setup....\migrations\env.py", line 95, in
run_migrations_online()
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin\setup....\migrations\env.py", line 87, in run_migrations_online
context.run_migrations()
File "", line 8, in run_migrations
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\runtime\environment.py", line 946, in run_migrations
self.get_context().run_migrations(**kw)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\runtime\migration.py", line 628, in run_migrations
step.migration_fn(**kw)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\migrations\versions\a77a0932a568
.py", line 28, in upgrade
with op.batch_alter_table("server") as batch_op:
File "contextlib.py", line 144, in
exit
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\base.py", line 398, in batch_alter_table
impl.flush()
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\batch.py", line 162, in flush
fn(*arg, **kw)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\batch.py", line 701, in drop_constraint
raise ValueError("No such constraint: '%s'" % const.name)
ValueError: No such constraint: 'ck_port_range'
2024-09-23 13:30:31,856: ERROR pgadmin: Exception in database migration.
2024-09-23 13:30:32,028: ERROR pgadmin: Database migration failed
NOTE: Configuring authentication for DESKTOP mode.
NOTE: Configuring authentication for DESKTOP mode.
2024-09-23 13:30:32,030: ERROR pgadmin: Traceback (most recent call last):
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\batch.py", line 690, in drop_constraint
const = self.named_constraints.pop(const.name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'ck_port_range'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin_init_.py", line 386, in upgrade_db
db_upgrade(app)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin\setup\db_upgrade.py", line 25, in db_upgrade
flask_migrate.upgrade(migration_folder)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\flask_migrate_init_.py", line 111, in wrapped
f(*args, **kwargs)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\flask_migrate_init_.py", line 200, in upgrade
command.upgrade(config, revision, sql=sql, tag=tag)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\command.py", line 406, in upgrade
script.run_env()
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\script\base.py", line 582, in run_env
util.load_python_file(self.dir, "env.py")
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\util\pyfiles.py", line 95, in load_python_file
module = load_module_py(module_id, path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\util\pyfiles.py", line 113, in load_module_py
spec.loader.exec_module(module) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 995, in exec_module
File "", line 488, in call_with_frames_removed
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin\setup....\migrations\env.py", line 95, in
run_migrations_online()
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin\setup....\migrations\env.py", line 87, in run_migrations_online
context.run_migrations()
File "", line 8, in run_migrations
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\runtime\environment.py", line 946, in run_migrations
self.get_context().run_migrations(**kw)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\runtime\migration.py", line 628, in run_migrations
step.migration_fn(**kw)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\migrations\versions\a77a0932a568
.py", line 28, in upgrade
with op.batch_alter_table("server") as batch_op:
File "contextlib.py", line 144, in
exit
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\base.py", line 398, in batch_alter_table
impl.flush()
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\batch.py", line 162, in flush
fn(*arg, **kw)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\batch.py", line 701, in drop_constraint
raise ValueError("No such constraint: '%s'" % const.name)
ValueError: No such constraint: 'ck_port_range'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\batch.py", line 690, in drop_constraint
const = self.named_constraints.pop(const.name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'ck_port_range'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin_init_.py", line 372, in backup_db_file
db_upgrade(app)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin\setup\db_upgrade.py", line 25, in db_upgrade
flask_migrate.upgrade(migration_folder)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\flask_migrate_init_.py", line 111, in wrapped
f(*args, **kwargs)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\flask_migrate_init_.py", line 200, in upgrade
command.upgrade(config, revision, sql=sql, tag=tag)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\command.py", line 406, in upgrade
script.run_env()
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\script\base.py", line 582, in run_env
util.load_python_file(self.dir, "env.py")
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\util\pyfiles.py", line 95, in load_python_file
module = load_module_py(module_id, path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\util\pyfiles.py", line 113, in load_module_py
spec.loader.exec_module(module) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 995, in exec_module
File "", line 488, in call_with_frames_removed
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin\setup....\migrations\env.py", line 95, in
run_migrations_online()
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin\setup....\migrations\env.py", line 87, in run_migrations_online
context.run_migrations()
File "", line 8, in run_migrations
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\runtime\environment.py", line 946, in run_migrations
self.get_context().run_migrations(**kw)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\runtime\migration.py", line 628, in run_migrations
step.migration_fn(**kw)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\migrations\versions\7c56ea250085
.py", line 26, in upgrade
with op.batch_alter_table("server") as batch_op:
File "contextlib.py", line 144, in
exit
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\base.py", line 398, in batch_alter_table
impl.flush()
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\batch.py", line 162, in flush
fn(*arg, **kw)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\batch.py", line 701, in drop_constraint
raise ValueError("No such constraint: '%s'" % const.name)
ValueError: No such constraint: 'ck_port_range'
Traceback (most recent call last):
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\batch.py", line 690, in drop_constraint
const = self.named_constraints.pop(const.name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'ck_port_range'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin_init_.py", line 386, in upgrade_db
db_upgrade(app)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin\setup\db_upgrade.py", line 25, in db_upgrade
flask_migrate.upgrade(migration_folder)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\flask_migrate_init_.py", line 111, in wrapped
f(*args, **kwargs)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\flask_migrate_init_.py", line 200, in upgrade
command.upgrade(config, revision, sql=sql, tag=tag)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\command.py", line 406, in upgrade
script.run_env()
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\script\base.py", line 582, in run_env
util.load_python_file(self.dir, "env.py")
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\util\pyfiles.py", line 95, in load_python_file
module = load_module_py(module_id, path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\util\pyfiles.py", line 113, in load_module_py
spec.loader.exec_module(module) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 995, in exec_module
File "", line 488, in call_with_frames_removed
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin\setup....\migrations\env.py", line 95, in
run_migrations_online()
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin\setup....\migrations\env.py", line 87, in run_migrations_online
context.run_migrations()
File "", line 8, in run_migrations
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\runtime\environment.py", line 946, in run_migrations
self.get_context().run_migrations(**kw)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\runtime\migration.py", line 628, in run_migrations
step.migration_fn(**kw)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\migrations\versions\a77a0932a568
.py", line 28, in upgrade
with op.batch_alter_table("server") as batch_op:
File "contextlib.py", line 144, in
exit
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\base.py", line 398, in batch_alter_table
impl.flush()
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\batch.py", line 162, in flush
fn(*arg, **kw)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\batch.py", line 701, in drop_constraint
raise ValueError("No such constraint: '%s'" % const.name)
ValueError: No such constraint: 'ck_port_range'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\batch.py", line 690, in drop_constraint
const = self.named_constraints.pop(const.name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'ck_port_range'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin_init_.py", line 372, in backup_db_file
db_upgrade(app)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin\setup\db_upgrade.py", line 25, in db_upgrade
flask_migrate.upgrade(migration_folder)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\flask_migrate_init_.py", line 111, in wrapped
f(*args, **kwargs)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\flask_migrate_init_.py", line 200, in upgrade
command.upgrade(config, revision, sql=sql, tag=tag)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\command.py", line 406, in upgrade
script.run_env()
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\script\base.py", line 582, in run_env
util.load_python_file(self.dir, "env.py")
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\util\pyfiles.py", line 95, in load_python_file
module = load_module_py(module_id, path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\util\pyfiles.py", line 113, in load_module_py
spec.loader.exec_module(module) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 995, in exec_module
File "", line 488, in call_with_frames_removed
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin\setup....\migrations\env.py", line 95, in
run_migrations_online()
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin\setup....\migrations\env.py", line 87, in run_migrations_online
context.run_migrations()
File "", line 8, in run_migrations
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\runtime\environment.py", line 946, in run_migrations
self.get_context().run_migrations(**kw)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\runtime\migration.py", line 628, in run_migrations
step.migration_fn(**kw)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\migrations\versions\7c56ea250085
.py", line 26, in upgrade
with op.batch_alter_table("server") as batch_op:
File "contextlib.py", line 144, in
exit
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\base.py", line 398, in batch_alter_table
impl.flush()
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\batch.py", line 162, in flush
fn(*arg, **kw)
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\python\Lib\site-packages\alembic\operations\batch.py", line 701, in drop_constraint
raise ValueError("No such constraint: '%s'" % const.name)
ValueError: No such constraint: 'ck_port_range'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgAdmin4.py", line 103, in
app = create_app()
^^^^^^^^^^^^
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin_init_.py", line 473, in create_app
run_migration_for_sqlite()
File "C:\Program Files\PostgreSQL\1\pgAdmin 4\web\pgadmin_init_.py", line 410, in run_migration_for_sqlite
upgrade_db()
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin_init_.py", line 391, in upgrade_db
backup_db_file()
File "C:\Program Files\PostgreSQL\17\pgAdmin 4\web\pgadmin_init_.py", line 379, in backup_db_file
raise RuntimeError('Migration failed')
RuntimeError: Migration failed

I already tried restarting the pgAdmin 4 service and even restating the windows. But nothing have worked so far.

Thanks in advance for the support you can provide.
Regards

pgadmin-support by date:

Previous
From: Akshay Joshi
Date:
Subject: pgAdmin 4 v8.12 Released
Next
From: Khushboo Vashi
Date:
Subject: Re: Error: The pgAdmin 4 server could not be contacted