Panniantong/Agent-Reach · error · ValueError

Automatic browser extraction is disabled for {spec['name']}.

Error message

Automatic browser extraction is disabled for {spec['name']}. Export the required cookies with Cookie-Editor, then use `agent-reach configure {manual_key}`.

What it means

Raised by _require_browser_extractable() in agent_reach/cookie_extract.py for platforms whose policy forbids automatic browser extraction. _COOKIE_EDITOR_ONLY maps 'twitter' -> 'twitter-cookies' and 'xhs' -> 'xhs-cookies': these platforms require a manual Cookie-Editor browser export (per project rules, Cookie-Editor export only, no QR login) instead of scraping the cookie store.

Source

Thrown at agent_reach/cookie_extract.py:202

        raise ValueError(
            "platform is required for browser-cookie extraction; "
            f"choose one of: {', '.join(_PLATFORM_SPECS_BY_KEY)}"
        )
    key = platform.lower()
    try:
        return _PLATFORM_SPECS_BY_KEY[key]
    except KeyError as exc:
        raise ValueError(
            f"Unsupported platform: {scrub_url_credentials(platform)}. "
            f"Supported: {', '.join(_PLATFORM_SPECS_BY_KEY)}"
        ) from exc


def _require_browser_extractable(spec: PlatformSpec) -> None:
    """Reject platforms whose project policy requires a manual cookie export."""
    manual_key = _COOKIE_EDITOR_ONLY.get(spec["config_key"])
    if manual_key:
        raise ValueError(
            f"Automatic browser extraction is disabled for {spec['name']}. "
            "Export the required cookies with Cookie-Editor, then use "
            f"`agent-reach configure {manual_key}`."
        )


def extract_all(
    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.

View on GitHub (pinned to 93ae1d18c3)

Solutions

  1. Install the Cookie-Editor browser extension, export the site cookies as JSON, then run `agent-reach configure twitter-cookies` (or xhs-cookies)
  2. Do not attempt QR-code login for XHS — it hangs by design; Cookie-Editor export is the only supported path
  3. Keep using extract_all only for bilibili and xueqiu

Example fix

# before
extract_all(browser='chrome', platform='xhs')  # ValueError: disabled

# after
# 1. Cookie-Editor extension -> Export (JSON) on xiaohongshu.com
# 2. CLI: agent-reach configure xhs-cookies
Defensive patterns

Strategy: validation

Validate before calling

COOKIE_EDITOR_ONLY = {'twitter', 'xhs'}
if platform.lower() in COOKIE_EDITOR_ONLY:
    raise ValueError('use Cookie-Editor export + agent-reach configure')

Type guard

def auto_extractable(platform: str) -> bool:
    return platform.lower() in {'bilibili', 'xueqiu'}

Try / catch

try:
    extract_all(browser=b, platform=platform)
except ValueError as e:
    if 'disabled' in str(e):
        # switch to the manual Cookie-Editor configuration flow
        run_cookie_editor_flow(platform)
    else:
        raise

Prevention

When it happens

Trigger: Calling extract_all(browser='chrome', platform='twitter') or platform='xhs' — automatic extraction is hard-disabled for these two regardless of browser or profile.

Common situations: Trying to automate XHS/Twitter login per the cookie-based auth flow; scripts written for bilibili/xueqiu being reused for twitter/xhs; not knowing the project policy excludes these platforms from rookiepy/browser_cookie3 reads.

Related errors


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