(Created on )

Puppeteer: Target not found for page

A BiDi page cannot find its corresponding browser-context target.


A BiDi page cannot find its corresponding browser-context target.

Error message

Target not found for page

How this error happens

A BiDi page can outlive its registration in the browser context’s target map. Looking up its target after context closure exercises that stale-page condition.

The snippets use a WebDriver BiDi browser named browser.

const context = await browser.createBrowserContext();
const page = await context.newPage();

await context.close();

page.target();

How to fix

Use page and target references while their owning context is alive.

const context = await browser.createBrowserContext();

try {
    const page = await context.newPage();
    const target = page.target();

    console.log(target.url());
} finally {
    await context.close();
}

Things to keep in mind

Depending on cleanup timing, a closed-page guard may report a related error first. Do not recreate the internal target map to make a stale page appear live.

All Puppeteer errors

Keep Reading

Puppeteer Guides

All Guides →