Troubleshooting

Cloudflare Challenge Errors and Fixes

Cloudflare Challenge solving is more complex than other CAPTCHA types because it requires proxy matching, IP binding, and user agent consistency. Here are the most common errors and how to fix each one.


API submission errors

ERROR_BAD_PARAMETERS

Cause: Missing required parameters.

Fix: Cloudflare Challenge requires these parameters:

method=cloudflare_challenge
pageurl=https://example.com
proxy=user:pass@host:port
proxytype=HTTP

All four are mandatory. Unlike Turnstile or reCAPTCHA, proxy is required.

ERROR_PROXY_CONNECTION_FAILED

Cause: CaptchaAI cannot connect through your proxy.

Fix:

  • Test the proxy independently: curl -x http://user:pass@host:port https://httpbin.org/ip
  • Ensure the proxy supports HTTPS
  • Check for IP whitelisting requirements on your proxy provider
  • Try a different proxy from the same provider

ERROR_PROXY_BANNED

Cause: Your proxy IP is blocked by Cloudflare.

Fix:

  • Switch to a residential or ISP proxy
  • Datacenter IPs are heavily flagged by Cloudflare
  • Rotate to a fresh IP and retry

ERROR_CAPTCHA_UNSOLVABLE

Cause: The challenge could not be solved, even after retries.

Fix:

  • The site may have changed its Cloudflare settings
  • Try a different proxy (the proxy IP itself may be blocked)
  • Wait 5 minutes and retry — Cloudflare may be in heightened security mode
  • Verify the page URL still shows a Cloudflare Challenge

Cause: IP mismatch between solve and usage.

Fix: Use the exact same proxy for subsequent requests:

# WRONG — different proxy for solving and requests
solve_proxy = "proxy1.example.com:8080"
request_proxy = "proxy2.example.com:8080"

# CORRECT — same proxy for both
proxy = "user:pass@proxy1.example.com:8080"

# Submit solve with this proxy
response = requests.get("https://ocr.captchaai.com/in.php", params={
    "key": API_KEY,
    "method": "cloudflare_challenge",
    "pageurl": "https://example.com",
    "proxy": proxy,
    "proxytype": "HTTP",
    "json": 1
})

# Use the SAME proxy for page requests
session = requests.Session()
session.cookies.set("cf_clearance", solved_cookie)
session.proxies = {"https": f"http://{proxy}"}

Cause: Different User-Agent between solve and requests.

Fix: Use the user agent returned in the solve response:

solution = result["request"]

# Extract and reuse the exact user agent
user_agent = solution.get("user_agent")

session = requests.Session()
session.headers["User-Agent"] = user_agent  # Must match exactly
session.cookies.set("cf_clearance", solution["cf_clearance"])

Cause: cf_clearance has a limited TTL (typically 15 min – 24 hours).

Fix:

  • Check when you obtained the cookie
  • Re-solve before the TTL expires
  • Implement automatic re-solving when you get a challenge page response
def make_request(url, session):
    response = session.get(url)
    if "challenge" in response.text.lower() or response.status_code == 403:
        # Cookie expired — re-solve
        new_cookie = solve_cloudflare_challenge(url, proxy)
        session.cookies.set("cf_clearance", new_cookie)
        response = session.get(url)
    return response

Timeout errors

Solve takes too long (>5 minutes)

Cause: Cloudflare Challenge pages can be slow when the proxy is slow or the challenge is complex.

Fix:

  • Use a faster proxy with lower latency
  • Increase your polling timeout to 60 attempts (5 minutes)
  • Check if the site actually has a Cloudflare Challenge vs a different protection

CAPCHA_NOT_READY persists

Cause: The solve is still in progress.

Fix:

  • Cloudflare Challenges take 20–60 seconds, longer than other types
  • Poll every 5 seconds for up to 60 attempts
  • If still not ready after 5 minutes, abort and retry with a different proxy

Common integration mistakes

Mistake Result Fix
Missing proxy parameter ERROR_BAD_PARAMETERS Always include proxy for CF Challenge
Using datacenter proxy ERROR_PROXY_BANNED Use residential proxies
Different UA for requests Cookie rejected Reuse the UA from the solution
Different IP for requests Cookie rejected Use the same proxy for all requests
Not setting cookie domain Cookie not sent Set domain to .example.com (with dot prefix)
Using HTTP instead of HTTPS Connection failed Cloudflare requires HTTPS

Debugging checklist

  1. ✅ Is the page actually behind Cloudflare Challenge? (not Turnstile or reCAPTCHA)
  2. ✅ Are all required parameters included? (method, pageurl, proxy, proxytype)
  3. ✅ Does the proxy work? Test with curl
  4. ✅ Is the proxy residential or ISP? (datacenter IPs get banned)
  5. ✅ Are you using the same proxy for solving AND requests?
  6. ✅ Are you using the returned user agent for requests?
  7. ✅ Is the cookie being set on the correct domain?
  8. ✅ Is the cookie still within its TTL?

FAQ

Why is proxy required for Cloudflare Challenge but not for reCAPTCHA?

Cloudflare binds the cf_clearance cookie to the IP address. The solve must happen from the same IP you'll use for subsequent requests. reCAPTCHA tokens are not IP-bound.

Can I use SOCKS5 proxies?

Yes. Set proxytype=SOCKS5 and format the proxy as user:pass@host:port.

Make a request with the cookie. If you get a 200 response with page content, it's valid. If you get a 403 or see "Checking your browser," the cookie has expired.

Why do I keep getting ERROR_CAPTCHA_UNSOLVABLE?

This usually means the proxy IP is heavily flagged by Cloudflare. Rotate to a new residential IP. If the error persists across multiple fresh IPs, the site may have extremely strict Cloudflare settings.


Discussions (0)

No comments yet.