Repository navigation
Description
version check --render and version export each guard the browser launch: when the browser cannot start, the gate prints one line (✗ render check failed — no browser launched: …, or export's export needs a browser, and none launched …) and exits 1. The step before it, Playwright starting its own driver, has no guard. When that driver process exits at startup, the sync_playwright() context manager's __enter__ raises AttributeError: 'PlaywrightContextManager' object has no attribute '_playwright' (playwright-python assumes its connection callback ran), the command dies on that traceback, and the real cause, Connection.init: Connection closed while reading from the driver, is printed afterwards as an asyncio "Task exception was never retrieved". The driver's own stderr, if it wrote any, sits above both. Because the failure is an AttributeError out of __enter__ rather than a PlaywrightError from launch, a guard in the style of the existing one would need to wrap the context entry or pre-flight the driver.
This is how it fails on a Linux host whose glibc is older than the Node bundled with the Playwright wheel needs (2.28), or where PLAYWRIGHT_NODEJS_PATH names a Node older than the driver requires (20). Both are ordinary on a CentOS 7 or RHEL 7 machine. The loader names the bundled binary in the first case and a TypeError from the driver bundle names nothing in the second; neither says that PLAYWRIGHT_NODEJS_PATH is the knob, which is the line that would settle it in seconds.
Reproduces on any machine, no old host needed (export needs a stamped page):
PLAYWRIGHT_NODEJS_PATH=/bin/false leaf version check <page> --render
PLAYWRIGHT_NODEJS_PATH=/bin/false leaf version export <page> -o out.html
Observed: for check, the deterministic line (✓ index.html: parses, …) on stdout, then on stderr the _playwright AttributeError traceback, then Task exception was never retrieved with the Connection.init: Connection closed while reading from the driver traceback; exit 1. Export prints the two tracebacks alone. The Python-side output is byte-identical to the real failures; only the driver's stderr block above it differs.
Expected: the gate's one-line message in the style of the browser one, naming the Node that was run (PLAYWRIGHT_NODEJS_PATH, or the wheel's bundled driver/node) and exiting 1, for both commands.
Seen on leaf dd36f95.
This was written by Claude Code on behalf of max-sixty
Activity
leaf-agent commentedon Sep 15, 2026
Reproduced and fixed in #725, which still needs review before it lands.
The cause is where you placed it:
sync_playwright()'s context entry returnsself._playwright, assigned by the connection callback, and a driver that exitsat startup never runs that callback. Wrapping the entry turns out to also be
what silences the second traceback — the reason lives on the connection's init
task, and reading it off that task both supplies the message and keeps asyncio
from reporting it as unretrieved. So one guard covers both halves of the output:
With the variable unset the hint names the wheel's bundled
driver/nodeandthen the variable that replaces it, which is the CentOS 7 arm.
One decision worth your eye: the reason is only reachable through Playwright
privates (
_connection._init_task), so every reading there is optional and aplain sentence stands in for a missing one — the path whose whole point is that
an attribute error stops being what the reader sees is a bad place to raise a
second one.
driver_node()avoids the same exposure by readingPLAYWRIGHT_NODEJS_PATHand the package location directly rather than callingplaywright._impl._driver.compute_driver_executable.