Skip to content

Cannot switch Google accounts: login reuses cached browser profile + crashes on new account #246

@Halmurat-Uyghur

Description

@Halmurat-Uyghur

Bug Summary

notebooklm login cannot switch to a different Google account. Two issues:

  1. Cached browser profile auto-logs in: Even after deleting ~/.notebooklm/storage_state.json, running notebooklm login automatically logs into the previously authenticated account because the browser profile at ~/.notebooklm/browser_profile/ retains Google session cookies.

  2. Crash when adding new account: When attempting to click "Use another account" on the Google sign-in page, the browser closes and throws a TargetClosedError.

Steps to Reproduce

  1. Authenticate with Account A: notebooklm login
  2. Delete auth state: rm ~/.notebooklm/storage_state.json
  3. Run notebooklm login again — it auto-logs into Account A (no account picker shown)
  4. If you manually navigate to "Use another account" before it auto-redirects, the browser closes with:
playwright._impl._errors.TargetClosedError: Page.goto: Target page, context or browser has been closed

Expected Behavior

  • A notebooklm logout command (or notebooklm auth logout) that clears both storage_state.json and the browser profile session
  • OR notebooklm login --new / notebooklm login --account flag that opens a fresh browser context without cached Google sessions

Workaround

Manually delete the entire browser profile directory before re-login:

rm -rf ~/.notebooklm/browser_profile ~/.notebooklm/storage_state.json
notebooklm login

Environment

  • notebooklm-py: v0.3.4
  • Python: 3.14
  • OS: macOS (Darwin 24.6.0)
  • Playwright browser: Chromium (bundled)

Interested in Contributing

Happy to submit a PR for this if the maintainers agree on the approach (e.g., adding a logout command or a --fresh flag to login).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions