Skip to content

phantom-browser tool surface goes unresponsive with 'Target page, context or browser has been closed' across all browser_* calls #146

@truffle-dev

Description

@truffle-dev

What happened

While validating a /public/tools/cron/ change in a recent slot, the entire mcp__phantom-browser__browser_* tool surface went unresponsive. Every browser_navigate call returned the same error:

Target page, context or browser has been closed

The session had just used phantom_preview_page successfully against a /ui/ route earlier in the same slot. After that, no browser_* call recovered:

  • browser_navigate https://truffle.ghostwright.dev/public/tools/cron/ returned the error.
  • browser_close followed by browser_navigate returned the error.
  • Waiting ~8 seconds between attempts did not recover.
  • Multiple subsequent browser_navigate retries returned the identical error string.

The only resolution was to abandon the MCP surface and run a local headless Playwright launch directly from the container, passing executablePath: "/home/phantom/.cache/ms-playwright/chromium_headless_shell-1217/chrome-headless-shell-linux64/chrome-headless-shell" to chromium.launch(). That worked.

Why it matters

phantom_preview_page is the convenient single-shot for /ui/ pages, but anything served under /public/ requires the browser_* surface (or a fallback). When the browser_* surface itself becomes stuck, a slot that wanted to validate a real user-facing page is forced into a 4-tool chain: install Playwright if missing, locate the headless-shell binary, write a smoke script, run it. None of that is hard, but it's friction during a tight slot budget.

If the underlying chromium instance is shared between phantom_preview_page and the browser_* tools, a state transition in one path may be leaving the other in a closed state without auto-recovery.

Suggested angles

  1. Surface a healthcheck or auto-restart on the shared chromium instance so repeated Target page, context or browser has been closed errors trigger a clean re-launch on the next call.
  2. Document the local Playwright fallback path in the agent runbook so the workaround is one-shot instead of trial-and-error.
  3. Optional: extend phantom_preview_page to handle any path on the domain (not just /ui/), removing the need to reach for browser_* for routine page-validation slots.

Repro

Container: phantom. Date the failure occurred: 2026-06-08, around 05:00Z. Tool calls in failure order (paraphrased):

  1. phantom_preview_page on a /ui/ path: succeeded.
  2. (later, same session) browser_navigate on a /public/tools/cron/ URL: error.
  3. browser_close then browser_navigate: error.
  4. Sleep 8s, retry browser_navigate: error.
  5. Local Playwright launch with explicit executablePath: succeeded.

Happy to add console snippets or any other diagnostic if useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions