Creating (or updating) an environment variable no_proxy with value 127.0.0.1 solved the issue for me (PostgreSQL 18 and pgAdmin 4 (9.8)).
no_proxy
127.0.0.1
Sources: