Skip to content
MtrXTools

Max retries exceeded with url

requests gave up connecting to the URL

Seen in Python requests, urllib3 (MaxRetryError, requests.exceptions.ConnectionError)

urllib3 could not get a response after its retries; the real error is in the "Caused by" part of the message.

Common causes

  • "NameResolutionError" or "Name or service not known": the hostname does not resolve.
  • "Connection refused" or "timed out": nothing is listening, or a firewall blocks the port.
  • "SSLError": a certificate or TLS handshake problem.
  • "ProxyError": the configured proxy is unreachable or rejected the request.

How to fix it

  1. Read the "Caused by ..." text at the end of the message and fix that underlying error.
  2. Check the host and port in "HTTPSConnectionPool(host=..., port=...)" are what you expect.
  3. Check HTTP_PROXY, HTTPS_PROXY and NO_PROXY in the environment.
  4. Test the same URL with curl from the same machine or container.

Got a different message? Paste it into the error explainer.

Related errors

All 32 Languages & runtimes errors