Panniantong/Agent-Reach · error · ValueError

Unsupported platform: {scrub_url_credentials(platform)}. Sup

Error message

Unsupported platform: {scrub_url_credentials(platform)}. Supported: {', '.join(_PLATFORM_SPECS_BY_KEY)}

What it means

Raised by _platform_spec() in agent_reach/cookie_extract.py when the platform string is not a key in _PLATFORM_SPECS_BY_KEY (case-insensitive lookup via platform.lower()). Supported keys are 'twitter', 'xhs', 'bilibili', 'xueqiu'. The message scrubs credentials from the input before echoing it.

Source

Thrown at agent_reach/cookie_extract.py:192

    hint = f" Available profiles: {available}." if available else ""
    raise ValueError(
        f"Profile '{scrub_url_credentials(profile)}' not found for "
        f"{scrub_url_credentials(browser)}.{hint}"
    )


def _platform_spec(platform: Optional[str]) -> PlatformSpec:
    """Return the one explicitly requested platform specification."""
    if not platform:
        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",

View on GitHub (pinned to 93ae1d18c3)

Solutions

  1. Use one of the exact keys listed in the message: twitter, xhs, bilibili, xueqiu
  2. Note 'XiaoHongShu' is addressed by the key 'xhs', not its display name
  3. If you need a genuinely unsupported platform, export cookies manually with Cookie-Editor and configure via the CLI

Example fix

# before
extract_all(browser='chrome', platform='xiaohongshu')  # ValueError

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

Strategy: validation

Validate before calling

SUPPORTED = {'twitter', 'xhs', 'bilibili', 'xueqiu'}
if platform.lower() not in SUPPORTED:
    raise ValueError(f'unsupported platform {platform!r}')

Type guard

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

Try / catch

try:
    extract_all(browser=b, platform=platform)
except ValueError as e:
    if 'Unsupported platform' in str(e):
        # fall back to manual Cookie-Editor flow for this platform
        instruct_cookie_editor(platform)
    else:
        raise

Prevention

When it happens

Trigger: Calling extract_all(platform='reddit'), platform='xiaohongshu' (full name instead of the 'xhs' key), or a typo like 'twiter'.

Common situations: Using the platform's full brand name instead of the short config key; mixing up keys from other parts of the CLI; stale code targeting a platform that was removed or renamed.

Related errors


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