Troubleshooting

ERROR_WRONG_GOOGLEKEY: Complete Diagnosis and Fix Guide

ERROR_WRONG_GOOGLEKEY means the googlekey parameter is invalid or doesn't match the target page. This guide covers every cause and fix.


What Causes This Error

Cause How to Identify
Incorrect sitekey extracted Key doesn't match page source
Enterprise sitekey sent as standard Need enterprise=1 parameter
Invisible reCAPTCHA key mismatch Need invisible=1 parameter
Dynamic sitekey changed Key rotated since extraction
Wrong page's sitekey Extracted from iframe or different domain
Hardcoded outdated sitekey Key was valid previously

How to Find the Correct Sitekey

import re
import requests


def extract_sitekey(page_url):
    """Extract reCAPTCHA sitekey from page source."""
    resp = requests.get(page_url, timeout=15)
    html = resp.text

    # Pattern 1: data-sitekey attribute
    match = re.search(r'data-sitekey="([^"]+)"', html)
    if match:
        return match.group(1)

    # Pattern 2: grecaptcha.render call
    match = re.search(r"grecaptcha\.render\([^,]+,\s*\{[^}]*sitekey['\"]?\s*:\s*['\"]([^'\"]+)", html)
    if match:
        return match.group(1)

    # Pattern 3: grecaptcha.execute call
    match = re.search(r"grecaptcha\.execute\(['\"]([^'\"]+)", html)
    if match:
        return match.group(1)

    # Pattern 4: reCAPTCHA script src
    match = re.search(r"recaptcha/api\.js\?render=([^&\"]+)", html)
    if match:
        return match.group(1)

    return None


sitekey = extract_sitekey("https://example.com/login")
print(f"Sitekey: {sitekey}")

Method 2: Browser DevTools

  1. Open target page in Chrome
  2. Press F12Elements tab
  3. Press Ctrl+F and search for sitekey
  4. Find data-sitekey="..." attribute
  5. Copy the value (40-character alphanumeric string)

Method 3: Network Tab

  1. Open F12Network tab
  2. Filter by recaptcha
  3. Look for requests to google.com/recaptcha/api2/anchor
  4. Find the k= parameter in the URL — that's the sitekey

Validation Before Submitting

import re


def validate_sitekey(sitekey):
    """Validate sitekey format before API call."""
    if not sitekey:
        raise ValueError("Sitekey is empty")

    # Standard format: 40 alphanumeric + hyphens/underscores
    if not re.match(r'^[a-zA-Z0-9_-]{20,60}$', sitekey):
        raise ValueError(f"Invalid sitekey format: {sitekey}")

    return True


# Use before solving
sitekey = extract_sitekey("https://example.com/login")
validate_sitekey(sitekey)

Handling reCAPTCHA Enterprise

Enterprise sitekeys look the same but require the enterprise parameter:

import requests

# Standard reCAPTCHA — loads via recaptcha/api.js
# Enterprise reCAPTCHA — loads via recaptcha/enterprise.js

def detect_enterprise(page_url):
    """Detect if page uses reCAPTCHA Enterprise."""
    resp = requests.get(page_url, timeout=15)
    return "recaptcha/enterprise.js" in resp.text


# Submit with enterprise flag
is_enterprise = detect_enterprise("https://example.com")

data = {
    "key": "YOUR_API_KEY",
    "method": "userrecaptcha",
    "googlekey": sitekey,
    "pageurl": "https://example.com",
    "json": 1,
}

if is_enterprise:
    data["enterprise"] = 1

resp = requests.post("https://ocr.captchaai.com/in.php", data=data)

Handling Invisible reCAPTCHA

def detect_invisible(html):
    """Detect invisible reCAPTCHA."""
    indicators = [
        'data-size="invisible"',
        "grecaptcha.execute(",
        "recaptcha/api.js?render=",
    ]
    return any(i in html for i in indicators)


# Submit with invisible flag
data = {
    "key": "YOUR_API_KEY",
    "method": "userrecaptcha",
    "googlekey": sitekey,
    "pageurl": "https://example.com",
    "invisible": 1,
    "json": 1,
}

Dynamic Sitekey Extraction

Some sites load sitekeys via JavaScript. Use a browser to extract them:

from selenium import webdriver
from selenium.webdriver.common.by import By


def extract_dynamic_sitekey(url):
    """Extract sitekey from JavaScript-rendered page."""
    driver = webdriver.Chrome()
    driver.get(url)

    # Wait for reCAPTCHA to load
    import time
    time.sleep(3)

    # Try data-sitekey attribute
    elements = driver.find_elements(By.CSS_SELECTOR, "[data-sitekey]")
    if elements:
        sitekey = elements[0].get_attribute("data-sitekey")
        driver.quit()
        return sitekey

    # Try iframe src parameter
    iframes = driver.find_elements(By.CSS_SELECTOR, "iframe[src*='recaptcha']")
    for iframe in iframes:
        src = iframe.get_attribute("src")
        import re
        match = re.search(r'[?&]k=([^&]+)', src)
        if match:
            driver.quit()
            return match.group(1)

    driver.quit()
    return None

Troubleshooting

Issue Cause Fix
Key looks correct but error persists Enterprise sitekey Add enterprise=1
Key changes between visits Dynamic sitekey Extract fresh key each time
Multiple sitekeys on page Wrong one selected Match key to the correct form
Key from CDN iframe Wrong domain's key Extract from main page, not iframe
Empty sitekey extracted JavaScript-rendered Use Selenium to extract

FAQ

What does a valid sitekey look like?

A reCAPTCHA sitekey is typically 40 characters of alphanumeric text plus hyphens. Example: 6Le-wvkSAAAAAPBMRTvw0Q4Muexq9bi0DJwx_mJ-.

Can the same sitekey work for both v2 and v3?

No. v2 and v3 use different sitekeys. Check the reCAPTCHA script source to determine the version.

Should I cache the sitekey?

Cache for short periods (minutes to hours). Some sites rotate keys. If solving starts failing, re-extract the sitekey.



Get the right sitekey — solve with CaptchaAI.

Discussions (0)

No comments yet.