Error reference cURL

How to fix cURL error 5: couldn't resolve proxy

curl: (5) Could not resolve proxy means curl never reached your proxy — the proxy's hostname failed DNS resolution before a single byte left your machine. In most cases the hostname curl actually tried isn't the one you meant: a stale environment variable, a stray character, or an unencoded password symbol quietly rewrote the proxy URL. Here's how to find it.

cURL Error 5: Couldn't Resolve Proxy

What cURL error 5 means

Exit code 5 maps to CURLE_COULDNT_RESOLVE_PROXY: curl was told to use a proxy — via -x/--proxy, a config file, or an environment variable — and the DNS lookup for that proxy's hostname returned nothing. The request failed at step zero; neither the proxy nor the target site was ever contacted.

Keep it separate from its siblings. Error 6 (couldn't resolve host) means the target hostname failed; error 7 means the proxy name resolved fine but the TCP connection was refused. Error 5 is specifically: this proxy name doesn't map to any IP address from where I'm standing.

Because the failing string is whatever curl parsed as the proxy hostname, malformed proxy URLs produce this error even when DNS is perfectly healthy. An unencoded @ in the password, a smart quote pasted from a document, or a trailing space can shift the parser so that a fragment of garbage becomes the hostname curl tries to resolve.

cURL Error 5: Couldn't Resolve Proxy

How to fix cURL error 5

Find out what hostname curl really tried, then check every place that string could have come from.

  1. Run the command with -v — verbose output prints the exact proxy hostname curl attempted, which instantly exposes mangled strings, stray characters, or a proxy source you didn't expect.
  2. Check environment variables: env | grep -i proxy. Stale http_proxy, https_proxy, or ALL_PROXY values — exported in a forgotten shell profile, CI job, or Docker image — are the most common cause when you never passed -x at all.
  3. Test DNS on the proxy host directly: dig +short residential.proxyomega.com or nslookup residential.proxyomega.com. If this fails too, the problem is your resolver, not curl.
  4. Inspect the proxy URL for invisible junk: trailing whitespace, smart quotes from copy-paste, or line breaks inside shell variables all end up inside the hostname.
  5. URL-encode credentials. An unencoded @, colon, slash, or # in the password splits the URL in the wrong place, and curl tries to resolve a fragment of your password as the proxy host. Encode @ as %40, : as %3A.
  6. Verify the format is scheme://user:password@host:port with nothing after the port. Targeting flags belong inside the username, never appended to the hostname.
  7. In containers and CI, check /etc/resolv.conf and whether the proxy hostname is resolvable from that network at all — internal names often only resolve on a VPN the runner isn't connected to.
  8. As a temporary isolation test, swap the hostname for the proxy's IP address; if that connects, the issue is purely DNS and you can fix the resolver separately.
cURL Error 5: Couldn't Resolve Proxy

Proxy URLs: where error 5 really comes from

In practice, error 5 is rarely about DNS infrastructure — a commercial proxy endpoint resolves through any standard public resolver. It's about the string. Proxy URLs concentrate several failure modes in one line: credentials with special characters, per-request targeting parameters, port numbers, and shell quoting. A mistake in any of them changes what the parser believes the hostname is.

ProxyOmega's URL structure keeps the moving parts in the username where they can't corrupt the hostname: targeting such as -country-us and -session-abc123 attaches to the username, the password is your dashboard API key, and the endpoint stays fixed at residential.proxyomega.com:10000. If you'd rather have no credentials in the URL at all, IP whitelist authentication removes them completely.

Environment variables you forgot you set

curl and most HTTP libraries honor http_proxy, https_proxy, and ALL_PROXY even when you never mention a proxy. A dead value exported months ago in .bashrc, baked into a Dockerfile ENV, or injected by CI produces error 5 on every request. Print them first and unset anything you don't recognize — an explicit -x flag beats guessing.

The @ that ate the hostname

curl splits the proxy URL's userinfo from its host at the @ separator. A raw @ or : inside the password moves that split point, so part of your credential is parsed as the hostname — and error 5 dutifully reports it can't resolve it. Percent-encode special characters, or sidestep the issue with ProxyOmega's IP whitelist so the URL is simply http://residential.proxyomega.com:10000.

DNS that only works somewhere else

Internal proxy hostnames that resolve only on a VPN, and containers whose resolv.conf points at an unreachable resolver, both produce error 5 in one environment and success in another. Public endpoints like residential.proxyomega.com resolve through any standard resolver, so if that lookup fails, fix the machine's DNS — not the URL.

cURL Error 5: Couldn't Resolve Proxy

A correctly formed proxy request

This snippet checks the usual suspects in order — environment, DNS, then a fully explicit and correctly encoded proxy URL — so you can watch error 5 disappear at whichever step was broken.

# 1. Any stale proxy settings hijacking curl?
env | grep -i proxy

# 2. Does the proxy hostname resolve at all?
dig +short residential.proxyomega.com

# 3. Explicit, correctly formed proxy URL.
#    Percent-encode special characters in the password (@ = %40, : = %3A)
curl -v \
     -x "http://USERNAME-country-us:[email protected]:10000" \
     https://api.ipify.org

# 4. With IP whitelisting enabled in the dashboard, drop credentials entirely
curl -v -x "http://residential.proxyomega.com:10000" https://api.ipify.org
FAQ

Frequently asked questions

What's the difference between cURL error 5 and error 6?
Error 5 means the proxy's hostname failed to resolve; error 6 means the target site's hostname failed. They point at opposite ends of the request. For error 5, inspect your proxy URL and environment variables. For error 6 while using a proxy, check whether you're resolving target names locally (socks5://) when the proxy should be doing it (socks5h://).
Why does curl use a proxy I never configured?
curl silently honors http_proxy, https_proxy, and ALL_PROXY environment variables, plus options in ~/.curlrc. Any of these can inject a proxy — often one that no longer exists — into every request without a single flag on the command line. Run env | grep -i proxy, inspect ~/.curlrc, and unset stale values or override them with an explicit -x.
My password has special characters — how do I put it in a proxy URL?
Percent-encode anything reserved: @ becomes %40, : becomes %3A, / becomes %2F, # becomes %23. Left unencoded, these shift how curl splits the URL, and a slice of your password gets treated as the hostname — the direct cause of many error 5 reports. On ProxyOmega the password is your dashboard API key; alternatively, whitelist your IP and omit credentials.
Can proxy rotation cause cURL error 5?
Not by itself — rotation happens after the connection is made, and ProxyOmega rotation is controlled through username parameters against a single fixed endpoint. Error 5 happens earlier, at hostname resolution. If a rotating setup produces it intermittently, you're likely cycling through a list of proxy hostnames where some entries are dead or misspelled — validate that list.

One endpoint, no dead proxy lists Start routing today.

residential.proxyomega.com — rotation, geo-targeting, and sessions controlled from the username.

ProxyOmega ProxyOmega

90M+ ethically-sourced IPs across 200+ countries and 30,000+ cities. Residential, mobile, ISP and IPv6 proxies for scraping and AI agents.

GDPRCCPA
Product
Premium Unlimited Budget Unlimited Residential / ISP Mobile IPv6 Chrome Extension
Solutions
Web scraping AI agents Price monitoring SERP & SEO Integrations All use cases
Resources
Glossary Error codes Free tools Proxies by platform Locations
Company
About Blog Docs Reseller program Affiliate Contact Sign in
© 2026 ProxyOmega Ltd. All rights reserved.