(Created on )

Puppeteer: The WebDriver BiDi implementation is failing to create a browsing context correctly.

BiDi context creation returned an ID before it was available in the context registry.


BiDi context creation returned an ID before it was available in the context registry.

Error message

The WebDriver BiDi implementation is failing to create a browsing context correctly.

How this error happens

The BiDi browser returned a browsing-context ID before its corresponding context was registered. This is an internal initialization or registry check, not an application input validator.

Use a running WebDriver BiDi browser named browser. The following is a lifecycle race to rule out.

await Promise.all([
    browser.newPage(),
    browser.close(),
]);

Creation and shutdown overlap in this example. Depending on event order, Puppeteer may report a target/session-closed error instead. It is not a deterministic reproduction of this particular registry message.

How to fix

Keep the browser and context alive until creation and page work finish. Run the corrected sequence with a fresh live browser.

const page = await browser.newPage();

try {
    await page.setContent(
        "<p>Page task</p>"
    );
} finally {
    await page.close();
}

Things to keep in mind

If this exact initialization error persists with sequential public API calls, retain the full stack and a minimal reproduction and report the browser/Puppeteer failure. Do not manufacture target IDs, initialize private maps, or retry an external side effect blindly.

All Puppeteer errors

Keep Reading

Puppeteer Guides

All Guides →