Troubleshooting

BLS CAPTCHA Errors and Troubleshooting

BLS CAPTCHA solving has unique challenges because it uses a custom implementation. Here are the most common errors and their solutions.


API submission errors

ERROR_BAD_PARAMETERS

Cause: Missing required parameters — either instructions or images.

Fix:

# WRONG — missing instructions
response = requests.post("https://ocr.captchaai.com/in.php", data={
    "key": API_KEY, "method": "bls",
    "image_base64_1": img1, "json": 1
})

# CORRECT — include instructions
response = requests.post("https://ocr.captchaai.com/in.php", data={
    "key": API_KEY, "method": "bls",
    "instructions": "Select all images with a car",
    "image_base64_1": img1, "json": 1
})

ERROR_WRONG_FILE_EXTENSION

Cause: Image data is not valid base64 or is an unsupported format.

Fix:

  • Ensure images are base64-encoded PNG or JPEG
  • Remove the data:image/...;base64, prefix
  • Verify the base64 string is not truncated
import base64

# Strip the data URI prefix
src = img_element.get_attribute("src")
if src.startswith("data:image"):
    b64 = src.split(",")[1]
else:
    # Download and encode
    img_data = requests.get(src).content
    b64 = base64.b64encode(img_data).decode()

ERROR_CAPTCHA_UNSOLVABLE

Cause: The images are too low quality, blurry, or the instruction is ambiguous.

Fix:

  • Capture images at full resolution
  • Ensure the instruction text is extracted correctly
  • Retry — some challenges are inherently more difficult

Image extraction errors

Images load dynamically

Problem: Images are not in the DOM when the page first loads.

Fix: Wait for the captcha to fully render:

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

# Wait for captcha images to load
WebDriverWait(driver, 10).until(
    EC.presence_of_all_elements_located((By.CSS_SELECTOR, ".captcha-image img"))
)

Images are canvases, not img elements

Problem: Some BLS implementations render images on <canvas> elements.

Fix: Extract canvas data as base64:

canvas_elements = driver.find_elements(By.CSS_SELECTOR, ".captcha-canvas")
for i, canvas in enumerate(canvas_elements, 1):
    b64 = driver.execute_script(
        "return arguments[0].toDataURL('image/png').split(',')[1];",
        canvas
    )
    payload[f"image_base64_{i}"] = b64

Images behind anti-hotlinking

Problem: Image URLs return 403 when fetched outside the browser.

Fix: Extract images within the browser context:

# Get image data from within the browser
b64 = driver.execute_script("""
    var img = arguments[0];
    var canvas = document.createElement('canvas');
    canvas.width = img.naturalWidth;
    canvas.height = img.naturalHeight;
    canvas.getContext('2d').drawImage(img, 0, 0);
    return canvas.toDataURL('image/png').split(',')[1];
""", img_element)

Solution application errors

Wrong images selected

Cause: Image ordering mismatch between extraction and display.

Fix: Maintain consistent ordering:

# Ensure images are indexed in display order
captcha_imgs = driver.find_elements(By.CSS_SELECTOR, ".captcha-image img")
# The order of find_elements matches DOM order = display order
for i, img in enumerate(captcha_imgs, 1):
    payload[f"image_base64_{i}"] = extract_base64(img)

Solution indices don't match

Cause: CaptchaAI returns 1-based indices, but your code uses 0-based.

Fix:

solution = result["request"]  # e.g., "1,3,5"
indices = [int(i) for i in solution.split(",")]

# Convert to 0-based for array access
for idx in indices:
    captcha_imgs[idx - 1].click()  # 1-based → 0-based

Form submission fails after correct selection

Cause: Additional form fields or tokens are missing.

Fix: Check for hidden fields that must be submitted alongside the captcha:

# Look for hidden captcha tokens
hidden_fields = driver.find_elements(By.CSS_SELECTOR, "input[type='hidden']")
for field in hidden_fields:
    name = field.get_attribute("name")
    value = field.get_attribute("value")
    print(f"Hidden field: {name}={value}")

Timeout errors

Captcha expires before solve completes

Problem: BLS CAPTCHA has a short validity window.

Fix:

  • Extract images and submit to CaptchaAI immediately
  • Do not extract images and then wait before submitting
  • If the solve takes >60 seconds, the captcha may have expired — refresh and retry

Polling takes too long

Fix: Ensure you are polling correctly:

# Standard polling pattern
for _ in range(30):  # 30 attempts × 5 seconds = 150 seconds max
    time.sleep(5)
    result = requests.get("https://ocr.captchaai.com/res.php", params={
        "key": API_KEY, "action": "get", "id": task_id, "json": 1
    }).json()

    if result.get("status") == 1:
        return result["request"]
    if result.get("request") == "ERROR_CAPTCHA_UNSOLVABLE":
        # Don't keep polling — start over
        raise Exception("Unsolvable")

Debugging checklist

Check Action
Instructions extracted? Print and verify the instruction text
Images valid? Save base64 to file and open to verify
Image count correct? Compare number of images sent vs displayed
Image order correct? Verify DOM order matches display order
Base64 prefix stripped? Remove data:image/...;base64,
Solution format? Parse comma-separated 1-based indices
Index conversion? Subtract 1 for 0-based array access

FAQ

How many images should I send to CaptchaAI?

Send all images displayed in the CAPTCHA, typically 3–9. Use image_base64_1 through image_base64_9.

What if the instruction is in a non-English language?

Send the instruction exactly as displayed. CaptchaAI handles multilingual instructions.

Can I preload images to speed up solving?

No. BLS generates unique images per session. You must extract them fresh for each captcha instance.

What if BLS changes their CAPTCHA format?

If the format changes, image extraction code may need updating. The CaptchaAI API parameters (method=bls, instructions, images) will remain the same.


Discussions (0)

No comments yet.

Related Posts

Explainers How BLS CAPTCHA Works: Grid Logic and Image Selection
Deep dive into BLS CAPTCHA grid logic — how images are arranged, how instructions map to selections, and how Captcha AI processes BLS challenges.

Deep dive into BLS CAPTCHA grid logic — how images are arranged, how instructions map to selections, and how C...

Automation BLS CAPTCHA
Apr 09, 2026
Use Cases Government Portal Automation with CAPTCHA Solving
Automate government portal interactions (visa applications, permit filings, records requests) with Captcha AI handling CAPTCHA challenges.

Automate government portal interactions (visa applications, permit filings, records requests) with Captcha AI...

Automation Python reCAPTCHA v2
Jan 30, 2026
Explainers How BLS CAPTCHA Works
Understand how BLS CAPTCHA works on visa appointment systems.

Understand how BLS CAPTCHA works on visa appointment systems. Learn about its image selection mechanism, how i...

Automation BLS CAPTCHA
Apr 06, 2026
Tutorials BLS CAPTCHA: Understanding Instructions Codes and Solving
how BLS CAPTCHA instruction codes work, how to extract grid images, and how to solve BLS CAPTCHAs with Captcha AI's API.

Learn how BLS CAPTCHA instruction codes work, how to extract grid images, and how to solve BLS CAPTCHAs with C...

Automation Python BLS CAPTCHA
Mar 15, 2026
Comparisons BLS CAPTCHA vs reCAPTCHA Grid — Comparison
Compare BLS CAPTCHA and re CAPTCHA grid challenges.

Compare BLS CAPTCHA and re CAPTCHA grid challenges. Learn the differences in format, solving approach, and Cap...

Automation Migration BLS CAPTCHA
Feb 12, 2026
API Tutorials Solve BLS CAPTCHA with Node.js and CaptchaAI
Step-by-step Node.js tutorial for solving BLS grid CAPTCHAs using the Captcha AI API.

Step-by-step Node.js tutorial for solving BLS grid CAPTCHAs using the Captcha AI API. Includes grid extraction...

Automation BLS CAPTCHA Node.js
Mar 07, 2026
API Tutorials Solve BLS CAPTCHA with Python and CaptchaAI
Step-by-step Python tutorial for solving BLS grid CAPTCHAs using the Captcha AI API.

Step-by-step Python tutorial for solving BLS grid CAPTCHAs using the Captcha AI API. Includes image extraction...

Automation Python BLS CAPTCHA
Mar 29, 2026
API Tutorials How to Solve BLS CAPTCHA Step by Step
Complete guide to solving BLS CAPTCHAs with Captcha AI API.

Complete guide to solving BLS CAPTCHAs with Captcha AI API. Includes image extraction, multi-image submission,...

Automation BLS CAPTCHA
Feb 04, 2026
Reference CAPTCHA Token Injection Methods Reference
Complete reference for injecting solved CAPTCHA tokens into web pages.

Complete reference for injecting solved CAPTCHA tokens into web pages. Covers re CAPTCHA, Turnstile, and Cloud...

Automation Python reCAPTCHA v2
Apr 08, 2026
Troubleshooting GeeTest v3 Error Codes: Complete Troubleshooting Reference
Complete reference for Gee Test v 3 error codes — from registration failures to validation errors — with causes, fixes, and Captcha AI-specific troubleshooting.

Complete reference for Gee Test v 3 error codes — from registration failures to validation errors — with cause...

Automation Testing GeeTest v3
Apr 08, 2026
Troubleshooting Turnstile Token Invalid After Solving: Diagnosis and Fixes
Fix Cloudflare Turnstile tokens that come back invalid after solving with Captcha AI.

Fix Cloudflare Turnstile tokens that come back invalid after solving with Captcha AI. Covers token expiry, sit...

Python Cloudflare Turnstile Web Scraping
Apr 08, 2026
Troubleshooting Common GeeTest v3 Errors and Fixes
Diagnose the most common Gee Test v 3 errors — stale challenge, bad parameters, validation failures — and fix them with practical troubleshooting steps.

Diagnose the most common Gee Test v 3 errors — stale challenge, bad parameters, validation failures — and fix...

Automation Testing GeeTest v3
Jan 24, 2026
Troubleshooting CaptchaAI API Error Handling: Complete Decision Tree
Complete decision tree for every Captcha AI API error.

Complete decision tree for every Captcha AI API error. Learn which errors are retryable, which need parameter...

Automation Python All CAPTCHA Types
Mar 17, 2026