Diagnostics follow-up (requested) + new bug: exitCode=21 persistent context lock conflict — 0.8.44
Product
VS Code extension (perplexity-vscode)
Version
perplexity-user-mcp 0.8.44-universal
MCP Client (if applicable)
Other
Perplexity tier
Pro
OS
Windows 11 Pro 10.0.26200, Node.js v22.21.1
Browser used by the MCP server
Chrome 148.0.7778.167
What happened?
Thank you again for the incredibly detailed analysis and the patience with every follow-up — and for the diagnostic improvements that land with each release. The daemon-status error surfacing added in 0.8.44 immediately identified the new failure mode described below. That kind of iteration is genuinely appreciated.
After updating to 0.8.44 and performing a clean reinstall with a fresh login (email one-time code, browser opened and closed correctly, meta.json confirms tier: Pro, lastLogin: 2026-05-14T16:04:24Z), the daemon remains permanently in anonymous mode. The vault decrypts cleanly (PR #4 fix confirmed working), but every Chrome launch via launchPersistentContext fails immediately with exitCode=21 before any page loads.
Steps to reproduce:
- Install 0.8.44 on Windows 11, Antigravity (Claude Code MCP client), stdio-daemon-proxy transport
- Run Perplexity: Login from VS Code command palette
- Browser opens → enter email one-time code → browser closes (login confirmed, tier: Pro in meta.json)
- Call any Pro tool (perplexity_reason, perplexity_models) → Account tier: Anonymous
- Perplexity: Login repeated → same result
Root cause hypothesis: The daemon holds personal/browser-data/Default/LOCK and personal/browser-data/lockfile open via launchPersistentContext. Every subsequent Chrome launch against the same --user-data-dir — whether from a reinit cycle, a Pro tool call, or the Doctor probe — fails immediately with exitCode=21 (ERROR_NOT_READY, Windows profile lock conflict). This creates a self-reinforcing deadlock: the daemon cannot recover on its own because every reinit attempt hits the same lock it holds itself. The only escape is a full VS Code restart or manually killing the daemon process, after which the cycle begins again from scratch.
This behavior was not present in 0.8.39/0.8.42 with the non-persistent launch path — Chrome ran through to Cloudflare resolution before failing. The regression appears to have been introduced by the switch to launchPersistentContext as part of the Bug 2 / cf_clearance handoff fix.
Requested diagnostics (from your previous reply): Active profile: personal
Profile directory structure: default/ ← present but empty (no vault.enc — inert leftover from prior reinstall) personal/ meta.json vault.enc models-cache.json daemon-status.json cookies.json .reinit login-browser-data/ browser-data/ Environment variables (User + Machine scope):
PERPLEXITY_PROFILE = (not set) PERPLEXITY_HEADLESS_ONLY = (not set)
Bug 1 (HEADLESS_ONLY leak) is not active in this configuration.
Doctor output (optional, recommended)
# Perplexity Doctor report -- [X] FAIL
Generated 2026-05-14T19:14:59.396Z in 730ms
Active profile: `personal` (probe ran)
## [OK] runtime -- pass
- [OK] node-version -- Node.js v22.21.1
- [OK] platform -- win32 x64
- [OK] arch -- x64
- [OK] package-version -- perplexity-user-mcp 0.0.0
## [OK] config -- pass
- [OK] config-dir -- Config dir present at C:\Users\coding\.perplexity-mcp
- [OK] active-pointer -- personal
## [!] profiles -- warn
- [OK] profile-count -- 1 profile(s): personal
- [OK] personal/meta -- valid
- [OK] personal/vault -- encrypted
- [OK] personal/models-cache -- 0d old
- [!] personal/daemon-status -- daemon last init: 2026-05-14T18:51:14.433Z — authenticated: false (tier: Anonymous), error: browserType.launchPersistentContext: Target page, context or browser has been closed
<launching> chrome.exe ... --user-data-dir=...personal\browser-data --headless
<launched> pid=2412
[pid=2412] <gracefully close start>
[pid=2412] <kill>
[pid=2412] <will force kill>
taskkill stderr: FEHLER: Der Prozess "2412" wurde nicht gefunden.
[pid=2412] <process did exit: exitCode=21, signal=null>
- personal/login-browser-data -- login-browser-data directory present (leftover from a past login session; safe to ignore)
## [OK] vault -- pass
- [OK] encryption -- AES-256-GCM (vault.enc)
- [OK] unseal-path -- env var (keychain unavailable — expected on headless Linux)
- [OK] unseal-verify -- vault.enc decrypts cleanly with the active unseal material
## [OK] browser -- pass
- [OK] chrome-family -- 148.0.7778.167
## [OK] native-deps -- pass
- [OK] patchright -- patchright v1.59.4
- [OK] got-scraping-chain -- header-generator -> dot-prop -> is-obj resolves
- [OK] impit -- impit 0.14.0
## [OK] network -- pass
- [OK] dns -- www.perplexity.ai -> 2606:4700::6812:1b30
- [OK] https -- HEAD / status 403
- [OK] cf-challenge -- no challenge detected
## [OK] mcp -- pass
- [OK] enabled-tools -- default profile 'full'
## [X] probe -- fail
- [X] probe-search -- probe failed: browserType.launchPersistentContext: Target page, context or browser has been closed
<launching> chrome.exe ... --user-data-dir=...personal\browser-data --headless
<launched> pid=8272
[pid=8272] <gracefully close start>
[pid=8272] <kill>
[pid=8272] <will force kill>
taskkill stderr: FEHLER: Der Prozess "8272" wurde nicht gefunden.
[pid=8272] <process did exit: exitCode=21, signal=null>
Relevant logs or errors
[perplexity-mcp] No authenticated session (anonymous mode)
browserType.launchPersistentContext: Target page, context or browser has been closed
[pid=2412] <process did exit: exitCode=21, signal=null>
taskkill stderr: FEHLER: Der Prozess "2412" wurde nicht gefunden.
Thank you for the exceptionally detailed report — your root-cause analysis was spot-on and made this fast to confirm.
Confirmed root cause
Exactly as you diagnosed. The 0.8.43 fix for #5 (commit c841124) switched the daemon's Phase 2 search context from an ephemeral chromium.launch() to a long-lived launchPersistentContext(browser-data) — to reuse the cf_clearance Phase 1 writes to disk. The side effect: the daemon now holds the browser-data Chromium process-singleton lock for its entire lifetime, and Chromium forbids a second launchPersistentContext on the same --user-data-dir. Three callers still contended for it:
- The Doctor probe — it spawns its own
PerplexityClient.init()(withPERPLEXITY_HEADLESS_ONLY=1) against the samebrowser-data, colliding head-on with the live daemon. That's thelaunchPersistentContext: Target page, context or browser has been closedin your doctor output — and it was also one of the racers that could knock the daemon out of its own reinit right after login. - The daemon's own Phase 1 → Phase 2 transition and the reinit cycle — on Windows
context.close()resolving doesn't release the profile lock synchronously, so relaunching on the same dir momentarily collides.
Two recovery gaps made it permanent rather than transient: clearStaleSingletonLocks only cleared the POSIX Singleton* files and never the Windows lockfile (your browser-data/lockfile), so the stale Windows lock was never removed; and there was no retry to ride out the release lag — so init() fell straight into anonymous mode.
Fix (0.8.46) — "single-owner + harden", keeping the cf_clearance reuse
- Doctor probe no longer launches a competing context when a live daemon owns the profile — it reports the daemon's real auth state instead (already surfaced by the
profiles/daemon-statuscheck). It's profile-aware, so probing a different profile still launches normally. Note:doctor --probewill now showprobe-search … skipwhile the daemon is up — that's intentional (you can't independently probe a profile the daemon owns without colliding); stop the daemon first for a standalone probe. - Both daemon
browser-datalaunches (Phase 1 headed bootstrap + Phase 2 headless) now clear stale locks — including the Windowslockfile— and retry with backoff, so the Phase 1→Phase 2 transition and the post-login reinit ride out the lock-release lag instead of dropping to anonymous mode.
Caveat
The lock-release timing is Windows-specific and can only be truly exercised against a real Chrome + daemon, so this is verified by unit/integration tests + typecheck but lands for the pre-release VSIX smoke to confirm on a real setup before tagging. If you can build from main and retry the login → Pro-tool flow on your Windows 11 box, a confirmation would be hugely helpful.
(Unrelated heads-up from your doctor output: package-version -- perplexity-user-mcp 0.0.0 — the version isn't reaching the doctor's runtime check. Minor diagnostic-accuracy bug, separate from this; happy to track it separately if you'd like.)