Panniantong/Agent-Reach · error · ValueError

Unsupported browser: {scrub_url_credentials(browser)}. Suppo

Error message

Unsupported browser: {scrub_url_credentials(browser)}. Supported: {', '.join(SUPPORTED_BROWSERS)}

What it means

Raised by extract_all() in agent_reach/cookie_extract.py when the browser string (after .lower()) is not in SUPPORTED_BROWSERS = ('chrome', 'firefox', 'edge', 'brave', 'opera'). The value is scrubbed with scrub_url_credentials before being echoed, so embedded secrets never leak into the message.

Source

Thrown at agent_reach/cookie_extract.py:228

    browser: str = "chrome",
    *,
    platform: Optional[str] = None,
    profile: Optional[str] = None,
) -> Dict[str, dict]:
    """
    Extract cookies for one explicitly requested platform.

    The legacy function name is retained for API compatibility, but an
    all-platform read is intentionally no longer supported.

    Returns:
        {"xueqiu": {"xq_a_token": "xxx"}}
    """
    spec = _platform_spec(platform)
    _require_browser_extractable(spec)
    browser = browser.lower()
    if browser not in SUPPORTED_BROWSERS:
        raise ValueError(
            f"Unsupported browser: {scrub_url_credentials(browser)}. "
            f"Supported: {', '.join(SUPPORTED_BROWSERS)}"
        )
    cookie_file = _profile_cookie_file(browser, profile) if profile else None
    needed_cookies = spec["cookies"]
    if needed_cookies is None:
        raise ValueError(
            f"Automatic full-domain extraction is disabled for {spec['name']}."
        )

    # Try rookiepy first (Rust-based, more stable), fallback to browser_cookie3
    use_rookiepy = False
    if cookie_file is None:
        try:
            import rookiepy
            use_rookiepy = True
        except ImportError:
            pass

View on GitHub (pinned to 93ae1d18c3)

Solutions

  1. Use exactly one of: chrome, firefox, edge, brave, opera (case-insensitive)
  2. Map generic names in your code: 'chromium' -> 'chrome', 'msedge' -> 'edge'
  3. Check the message — it lists the full supported set

Example fix

# before
extract_all(browser='chromium', platform='bilibili')  # ValueError

# after
extract_all(browser='chrome', platform='bilibili')
Defensive patterns

Strategy: validation

Validate before calling

SUPPORTED_BROWSERS = ('chrome', 'firefox', 'edge', 'brave', 'opera')
if browser.lower() not in SUPPORTED_BROWSERS:
    raise ValueError(f'unsupported browser {browser!r}')

Type guard

def is_supported_browser(browser: str) -> bool:
    return browser.lower() in ('chrome', 'firefox', 'edge', 'brave', 'opera')

Try / catch

try:
    extract_all(browser=browser, platform=p)
except ValueError as e:
    if 'Unsupported browser' in str(e):
        browser = 'chrome'
    else:
        raise

Prevention

When it happens

Trigger: Calling extract_all(browser='chromium', ...) or 'Safari', or a typo like 'Chrom' (lowercased to 'chrom' and rejected).

Common situations: Assuming any Chromium fork works; passing 'chromium' where 'chrome' is meant; case differences are tolerated by .lower() but name variants are not.

Related errors


AI-assisted analysis of Panniantong/Agent-Reach@93ae1d18c3 (2026-08-14). Data as JSON: /api/errors/64c08d82ef7eb104. Report an issue: GitHub.