Panniantong/Agent-Reach · error · SystemExit

agent-reach configure: error: {scrub_url_credentials(exc)}

Error message

agent-reach configure: error: {scrub_url_credentials(exc)}

What it means

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.

Source

Thrown at agent_reach/cli.py:1409

        print(f"Extracting {args.platform} cookies from {browser}...")
        print()

        try:
            results = configure_from_browser(
                browser,
                config,
                platform=platform,
                profile=args.profile,
            )
        except ValueError as exc:
            from agent_reach.utils.text import scrub_url_credentials

            print(
                f"agent-reach configure: error: "
                f"{scrub_url_credentials(exc)}",
                file=sys.stderr,
            )
            raise SystemExit(2) from None

        found_any = False
        for result in results:
            if hasattr(result, "platform"):
                result_platform = result.platform
                success = result.success
                message = result.message
                targets = getattr(result, "targets", ())
            else:
                legacy_result = cast(tuple[str, bool, str], result)
                result_platform, success, message = legacy_result
                targets = ()
            if success:
                print(f"  ✅ {result_platform}: {message}")
                if targets:
                    print(f"     写入:{', '.join(targets)}")
                found_any = True
            else:

View on GitHub (pinned to 93ae1d18c3)

Solutions

  1. Run with a definitely-supported browser first: agent-reach configure --from-browser chrome --platform xueqiu
  2. Make sure the browser is fully closed so its cookie store is not locked
  3. For Chrome on Windows v127+, fall back to manual Cookie-Editor export: agent-reach configure twitter-cookies --stdin
  4. If using a non-default profile, pass the correct --profile value (the browser's Profile folder name, not its display name)

Example fix

# before
agent-reach configure --from-browser brave --platform xueqiu

# after: supported browser + manual fallback if extraction still fails
agent-reach configure --from-browser chrome --platform xueqiu
# if that errors (exit 2):
#  1. install the Cookie-Editor extension in the browser, log in, export Header String
#  2. agent-reach configure xhs-cookies --stdin  # paste header string, Ctrl-D
Defensive patterns

Strategy: try-catch

Validate before calling

SUPPORTED_BROWSERS = {"chrome", "chromium", "firefox", "edge", "safari"}  # keep in sync with your agent-reach version

browser = args.from_browser.lower()
if browser not in SUPPORTED_BROWSERS:
    fail_fast(f"unsupported browser {browser}; try one of {sorted(SUPPORTED_BROWSERS)}")

Try / catch

# CLI exits 2 with the scrubbed message; branch in your wrapper:
import subprocess
r = subprocess.run(["agent-reach", "configure", "--from-browser", b, "--platform", p], capture_output=True, text=True)
if r.returncode == 2:
    switch_to_cookie_editor_manual_flow(p)  # documented fallback

Prevention

When it happens

Trigger: `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).

Common situations: 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).

Related errors


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