Skip to content

run-code async route callback exception closes daemon and reports only Session closed #476

Description

@brunobarrientos

An asynchronous route callback exception terminates the CLI daemon, while the invoking command reports only Session closed. The actual exception is left in the daemon .err file.

Observed on macOS arm64, Node 26.9.0, @playwright/cli 0.1.1 (declared Playwright dependency 1.59.0-alpha-1771104257000), isolated headless Chromium through an installed Brave executable and a dedicated disposable profile. No signed-in personal profile was used.

After opening the isolated session, the exact minimal failing command was:

playwright-cli -s=phone1256-20261004 run-code "async page => { await page.route('http://127.0.0.1:49152/owned-probe', async route => { throw new Error('owned route callback failure'); }); await page.goto('http://127.0.0.1:49152/owned-probe', { timeout: 5000 }); }"

The route throws before any request is continued; this needs no listening server or external website. Observed: command exit 1, empty stdout, stderr Session closed; session status becomes closed. The daemon error log contains Error: owned route callback failure from RouteHandler._handleInternal/RouteHandler.handle and the page route callback.

This also occurred during a real read-only probe when my callback used setTimeout, which is unavailable in the run-code VM. That caller error explains the callback exception. The issue here is the lost diagnostic and daemon termination, not a request to expose a new timer global.

Expected: return the actual callback exception to the command with an actionable error. If daemon termination is necessary, include the cause in the command response instead of returning only Session closed. The isolated session and logs were retained for diagnosis; no library patch, reinstall or shared-browser interruption was used.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions