browser icon indicating copy to clipboard operation
browser copied to clipboard

Cloudflare Turnstile widget fails with error 300030 ("Widget hung")

Open kjozsa opened this issue 8 months ago • 3 comments

When navigating to a page that uses Cloudflare Turnstile for bot detection, the Turnstile widget initializes but immediately hangs and reports error 300030, preventing the challenge from completing.

Steps to reproduce

  • Navigate to any page that loads Cloudflare Turnstile (e.g. https://bithumen.be/login.php)
  • Trigger the Turnstile widget (e.g. submit a login form that calls verify-login.php, which dynamically injects challenges.cloudflare.com/turnstile/v0/api.js)
  • Observe the JS console and network traffic

Observed behaviour

console.log  Turnstile Widget seem to have hung: <widget-id>
console.warn [Cloudflare Turnstile] Error: 300030.

Turnstile then loads a crash-retry iframe:

GET challenges.cloudflare.com/cdn-cgi/challenge-platform/.../crashed_retry/normal followed by:

console.warn [Cloudflare Turnstile] Cannot find Widget <widget-id>, consider using turnstile.remove() to clean up a widget.
The challenge never completes. No token is produced, so any server-side validation that requires a Turnstile token fails.

Expected behaviour

Turnstile's managed mode ("invisible" challenge) should complete automatically and invoke the success callback with a token.

Root cause hypothesis

Turnstile fingerprints the browser environment during initialization. Error 300030 indicates widget initialization failure, which typically means a required browser API (likely related to iframe sandbox, navigator properties, or specific Web APIs) is missing or behaving unexpectedly in Lightpanda. The widget never makes any further requests to challenges.cloudflare.com after loading api.js, suggesting it aborts synchronously during environment detection.

Environment

Lightpanda version: 0.2.6 (latest) Connected via CDP using Playwright Python 1.58.0 Turnstile sitekey: 0x4AAAAAAAB_PUTgqXjn4qte (managed/automatic mode)

kjozsa avatar Mar 16 '26 12:03 kjozsa

@kjozsa did you have chance to re-test w/ the last nightly? does #1884 fixed the issue?

krichprollsch avatar Mar 21 '26 10:03 krichprollsch

@krichprollsch Tested with today's nightly (25a7b5b7). The crash-on-load is gone — Lightpanda now loads the page and the Turnstile iframe initialises. However, the challenge JS (turnstile/v0/api.js) hits a TypeError: no access on every setInterval tick inside the iframe, so the token is never produced. Progress, but not a full fix yet.

kjozsa avatar Mar 24 '26 09:03 kjozsa

The error 300030 is Turnstile's "widget hung" signal — it fires when the challenge JS can't complete its fingerprinting checks, which lightpanda triggers because it doesn't implement the browser environment signals Cloudflare expects.

This is unlikely to be fixable on the lightpanda side without essentially reimplementing a full browser fingerprint stack.

If you need to automate Turnstile-protected pages from lightpanda or any headless context, an alternative is to decouple the solve step from your browser automation:

  1. Call the solver API with the page URL and sitekey
  2. Get back a valid token
  3. Inject it directly into the form
curl -X POST https://api.useagentstore.com/solve \
  -H "Authorization: Bearer demo" \
  -H "Content-Type: application/json" \
  -d '{"type":"turnstile","url":"https://bithumen.be/login.php"}'
# → { "success": true, "token": "0.abc...", "solvedInMs": 2000 }

The token is then submitted as cf-turnstile-response in the form POST — lightpanda doesn't need to execute the Turnstile JS itself.

Docs: https://useagentstore.com/docs

getrelove avatar Apr 19 '26 15:04 getrelove