python
network_error
ai_generated
true
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x...>: Failed to establish a new connection: [Errno 111] Connection refused'))
ID: python/requests-connectionerror-connection-refused
80%Fix Rate
88%Confidence
0Evidence
2025-07-30First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
No service is listening on the specified host and port.
generic中文
指定主机和端口上没有服务在监听。
Workarounds
-
95% success Start the server or ensure it is running on the correct port
Check if the server is running: netstat -tulpn | grep 8080 # Start the server if needed
-
80% success Use a different port that the server is actually listening on
requests.get('http://localhost:3000') # if server runs on port 3000
Dead Ends
Common approaches that don't work:
-
Increasing the timeout value
95% fail
The connection is refused immediately, so timeout does not matter.
-
Using a different protocol (e.g., HTTPS instead of HTTP)
90% fail
The port is not open for any protocol.