{"record":{"id":"406a10c11503b46a","repo":"Panniantong/Agent-Reach","slug":"agent-reach-configure-error-scrub-url-credentia","errorCode":null,"errorMessage":"agent-reach configure: error: {scrub_url_credentials(exc)}","messagePattern":"agent-reach configure: error: (.+?)","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"agent_reach/cli.py","lineNumber":1409,"sourceCode":"        print(f\"Extracting {args.platform} cookies from {browser}...\")\n        print()\n\n        try:\n            results = configure_from_browser(\n                browser,\n                config,\n                platform=platform,\n                profile=args.profile,\n            )\n        except ValueError as exc:\n            from agent_reach.utils.text import scrub_url_credentials\n\n            print(\n                f\"agent-reach configure: error: \"\n                f\"{scrub_url_credentials(exc)}\",\n                file=sys.stderr,\n            )\n            raise SystemExit(2) from None\n\n        found_any = False\n        for result in results:\n            if hasattr(result, \"platform\"):\n                result_platform = result.platform\n                success = result.success\n                message = result.message\n                targets = getattr(result, \"targets\", ())\n            else:\n                legacy_result = cast(tuple[str, bool, str], result)\n                result_platform, success, message = legacy_result\n                targets = ()\n            if success:\n                print(f\"  ✅ {result_platform}: {message}\")\n                if targets:\n                    print(f\"     写入：{', '.join(targets)}\")\n                found_any = True\n            else:","sourceCodeStart":1391,"sourceCodeEnd":1427,"githubUrl":"https://github.com/Panniantong/Agent-Reach/blob/93ae1d18c37b707dec053c7c4f9d91cd8ef8943d/agent_reach/cli.py#L1391-L1427","documentation":"During `agent-reach configure --from-browser`, browser cookie extraction can raise ValueError (unsupported browser name, browser profile not found, required cookies absent). The CLI catches it, scrubs any embedded URL credentials with scrub_url_credentials to avoid leaking secrets, prints 'agent-reach configure: error: <message>' to stderr, and exits with status 2.","triggerScenarios":"`agent-reach configure --from-browser <name>` where <name> is not one of the supported browsers (e.g. 'brave' when only chrome/chromium/firefox/edge/safari are supported), the browser's cookie store does not exist (fresh profile, non-default profile path), or profile discovery fails on locked/encrypted stores (Chrome's newer app-bound encryption on Windows).","commonSituations":"Browser name typos; users of Chromium forks whose profile layout differs; Windows Chrome v127+ where cookies are app-bound-encrypted and third-party readers fail; corporate machines with profiles in non-standard locations (passing --profile with a wrong path).","solutions":["Run with a definitely-supported browser first: agent-reach configure --from-browser chrome --platform xueqiu","Make sure the browser is fully closed so its cookie store is not locked","For Chrome on Windows v127+, fall back to manual Cookie-Editor export: agent-reach configure twitter-cookies --stdin","If using a non-default profile, pass the correct --profile value (the browser's Profile folder name, not its display name)"],"exampleFix":"# before\nagent-reach configure --from-browser brave --platform xueqiu\n\n# after: supported browser + manual fallback if extraction still fails\nagent-reach configure --from-browser chrome --platform xueqiu\n# if that errors (exit 2):\n#  1. install the Cookie-Editor extension in the browser, log in, export Header String\n#  2. agent-reach configure xhs-cookies --stdin  # paste header string, Ctrl-D","handlingStrategy":"try-catch","validationCode":"SUPPORTED_BROWSERS = {\"chrome\", \"chromium\", \"firefox\", \"edge\", \"safari\"}  # keep in sync with your agent-reach version\n\nbrowser = args.from_browser.lower()\nif browser not in SUPPORTED_BROWSERS:\n    fail_fast(f\"unsupported browser {browser}; try one of {sorted(SUPPORTED_BROWSERS)}\")","typeGuard":null,"tryCatchPattern":"# CLI exits 2 with the scrubbed message; branch in your wrapper:\nimport subprocess\nr = subprocess.run([\"agent-reach\", \"configure\", \"--from-browser\", b, \"--platform\", p], capture_output=True, text=True)\nif r.returncode == 2:\n    switch_to_cookie_editor_manual_flow(p)  # documented fallback","preventionTips":["Close the browser fully before cookie extraction so its store is unlocked","On Windows Chrome v127+, expect app-bound-encryption failures — keep Cookie-Editor manual export as your default flow","Pass --profile when your logins live in a non-default profile"],"tags":["cli","configure","browser","cookies","exit-code-2"],"backgroundTag":null,"analyzedSha":"93ae1d18c37b707dec053c7c4f9d91cd8ef8943d","analyzedAt":"2026-08-14T22:54:06.735Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}