Skip to content

credits user: UnexpectedError when the profile is open in the user's own Chrome #984

Closed

Description

@ffroliva

Observed (2026-10-15, develop code path)

gflow credits user --profile <p> --json, run while a plain Chrome window (not gflow) has that profile's directory open, exits 1 with:

{"status": "fail", "error": {"class": "UnexpectedError", "title": "Unexpected error", "exit_code": 1}}

Log trail: cookie_decryption_failed_falling_back_to_playwright → credits.http_fallback_to_browser error_type=TargetClosedError → client.preread_flow_cookies_failed → error_unhandled.

The crash is in the browser fallback at src/gflow_cli/services/credits.py:51 on develop. The Playwright launch exits because Chrome's own SingletonLock is held; ProfileLease cannot see a non-gflow Chrome.

Expected

A typed, actionable error, e.g. "profile is open in another Chrome window — close it and retry", not an UnexpectedError. Ideally exit 11 like ProfileLockedError.

Repro

  1. Pick a profile whose cookie decrypt falls back to Playwright.
  2. Start chrome.exe --user-data-dir=<profile_dir> about:blank.
  3. Run gflow credits user --profile <name> --json.

Found while spiking PR #982, which has the same class of defect in auth/renew.py:107 (reported there). A shared fix for "Chrome launch refused because the profile is held outside gflow" probably belongs in one launch helper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions