{"record":{"id":"29ddf405fba8bb56","repo":"Panniantong/Agent-Reach","slug":"profile-selection-is-supported-only-for-join","errorCode":null,"errorMessage":"Profile selection is supported only for {', '.join(PROFILE_SELECTABLE_BROWSERS)}, not {scrub_url_credentials(browser)}.","messagePattern":"Profile selection is supported only for (.+?), not (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent_reach/cookie_extract.py","lineNumber":160,"sourceCode":"                    \"folder\": profile_dir.name,\n                    \"cookies_path\": str(cookie_file),\n                }\n            )\n\n    def sort_key(item):\n        folder = item[\"folder\"]\n        suffix = folder.rsplit(\" \", 1)[-1]\n        number = int(suffix) if suffix.isdigit() else 0\n        return (folder != \"Default\", number, folder)\n\n    profiles.sort(key=sort_key)\n    return profiles\n\n\ndef _profile_cookie_file(browser: str, profile: str) -> str:\n    \"\"\"Resolve an explicit profile or fail without falling back to Default.\"\"\"\n    if browser not in PROFILE_SELECTABLE_BROWSERS:\n        raise ValueError(\n            \"Profile selection is supported only for \"\n            f\"{', '.join(PROFILE_SELECTABLE_BROWSERS)}, \"\n            f\"not {scrub_url_credentials(browser)}.\"\n        )\n\n    profiles = list_browser_profiles(browser)\n    for candidate in profiles:\n        if candidate[\"folder\"] == profile:\n            return candidate[\"cookies_path\"]\n\n    available = \", \".join(\n        scrub_url_credentials(item[\"folder\"]) for item in profiles\n    )\n    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    )","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/Panniantong/Agent-Reach/blob/93ae1d18c37b707dec053c7c4f9d91cd8ef8943d/agent_reach/cookie_extract.py#L142-L178","documentation":"Raised by _profile_cookie_file() in agent_reach/cookie_extract.py when a profile= argument is passed for a browser that does not support explicit profile selection. PROFILE_SELECTABLE_BROWSERS is ('chrome', 'edge', 'brave') — only Chromium browsers with numbered 'Profile N' folders under a User Data directory. Firefox ('firefox') and 'opera' are rejected because profile resolution is only implemented against the Chromium layout.","triggerScenarios":"Calling extract_all(browser='firefox', platform='bilibili', profile='default-release') or browser='opera' with any non-None profile.","commonSituations":"Assuming every browser in SUPPORTED_BROWSERS (chrome, firefox, edge, brave, opera) also accepts profile=; porting a Firefox multi-profile workflow to this API; passing profile='Default' unconditionally for all browsers.","solutions":["Use browser='chrome', 'edge', or 'brave' when you need profile selection","Drop the profile argument for firefox/opera and let rookiepy use the default profile","List valid folders first with list_browser_profiles(browser) to see what a supported browser exposes"],"exampleFix":"# before\nextract_all(browser='firefox', platform='bilibili', profile='release')  # ValueError\n\n# after\nextract_all(browser='chrome', platform='bilibili', profile='Profile 1')","handlingStrategy":"validation","validationCode":"from agent_reach.cookie_extract import PROFILE_SELECTABLE_BROWSERS\nif profile is not None and browser.lower() not in PROFILE_SELECTABLE_BROWSERS:\n    raise ValueError(f'profile selection unsupported for {browser}')","typeGuard":"def supports_profile(browser: str) -> bool:\n    return browser.lower() in ('chrome', 'edge', 'brave')","tryCatchPattern":"try:\n    extract_all(browser=b, platform=p, profile=prof)\nexcept ValueError as e:\n    if 'Profile selection' in str(e):\n        prof = None  # retry without profile on a default-profile browser\n    else:\n        raise","preventionTips":["Remember only Chromium browsers (chrome/edge/brave) expose profiles here","Gate the profile kwarg behind supports_profile() at your call site"],"tags":["cookies","browser","profile","validation"],"backgroundTag":null,"analyzedSha":"93ae1d18c37b707dec053c7c4f9d91cd8ef8943d","analyzedAt":"2026-08-14T22:54:06.735Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}