{"record":{"id":"b40e3d6b6275a1d7","repo":"Panniantong/Agent-Reach","slug":"unsupported-platform-scrub-url-credentials-platf","errorCode":null,"errorMessage":"Unsupported platform: {scrub_url_credentials(platform)}. Supported: {', '.join(_PLATFORM_SPECS_BY_KEY)}","messagePattern":"Unsupported platform: (.+?)\\. Supported: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent_reach/cookie_extract.py","lineNumber":192,"sourceCode":"    hint = f\" Available profiles: {available}.\" if available else \"\"\n    raise ValueError(\n        f\"Profile '{scrub_url_credentials(profile)}' not found for \"\n        f\"{scrub_url_credentials(browser)}.{hint}\"\n    )\n\n\ndef _platform_spec(platform: Optional[str]) -> PlatformSpec:\n    \"\"\"Return the one explicitly requested platform specification.\"\"\"\n    if not platform:\n        raise ValueError(\n            \"platform is required for browser-cookie extraction; \"\n            f\"choose one of: {', '.join(_PLATFORM_SPECS_BY_KEY)}\"\n        )\n    key = platform.lower()\n    try:\n        return _PLATFORM_SPECS_BY_KEY[key]\n    except KeyError as exc:\n        raise ValueError(\n            f\"Unsupported platform: {scrub_url_credentials(platform)}. \"\n            f\"Supported: {', '.join(_PLATFORM_SPECS_BY_KEY)}\"\n        ) from exc\n\n\ndef _require_browser_extractable(spec: PlatformSpec) -> None:\n    \"\"\"Reject platforms whose project policy requires a manual cookie export.\"\"\"\n    manual_key = _COOKIE_EDITOR_ONLY.get(spec[\"config_key\"])\n    if manual_key:\n        raise ValueError(\n            f\"Automatic browser extraction is disabled for {spec['name']}. \"\n            \"Export the required cookies with Cookie-Editor, then use \"\n            f\"`agent-reach configure {manual_key}`.\"\n        )\n\n\ndef extract_all(\n    browser: str = \"chrome\",","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/Panniantong/Agent-Reach/blob/93ae1d18c37b707dec053c7c4f9d91cd8ef8943d/agent_reach/cookie_extract.py#L174-L210","documentation":"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.","triggerScenarios":"Calling extract_all(platform='reddit'), platform='xiaohongshu' (full name instead of the 'xhs' key), or a typo like 'twiter'.","commonSituations":"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.","solutions":["Use one of the exact keys listed in the message: twitter, xhs, bilibili, xueqiu","Note 'XiaoHongShu' is addressed by the key 'xhs', not its display name","If you need a genuinely unsupported platform, export cookies manually with Cookie-Editor and configure via the CLI"],"exampleFix":"# before\nextract_all(browser='chrome', platform='xiaohongshu')  # ValueError\n\n# after\nextract_all(browser='chrome', platform='xhs')","handlingStrategy":"validation","validationCode":"SUPPORTED = {'twitter', 'xhs', 'bilibili', 'xueqiu'}\nif platform.lower() not in SUPPORTED:\n    raise ValueError(f'unsupported platform {platform!r}')","typeGuard":"def is_supported_platform(platform: str) -> bool:\n    return platform.lower() in {'twitter', 'xhs', 'bilibili', 'xueqiu'}","tryCatchPattern":"try:\n    extract_all(browser=b, platform=platform)\nexcept ValueError as e:\n    if 'Unsupported platform' in str(e):\n        # fall back to manual Cookie-Editor flow for this platform\n        instruct_cookie_editor(platform)\n    else:\n        raise","preventionTips":["Use the short keys (xhs not xiaohongshu)","Whitelist platforms at your CLI boundary before calling extract_all"],"tags":["cookies","platform","validation"],"backgroundTag":null,"analyzedSha":"93ae1d18c37b707dec053c7c4f9d91cd8ef8943d","analyzedAt":"2026-08-14T22:54:06.735Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}