Puppeteer: Session {value} was not created.
A target-attached event references a session absent from the connection registry.
A target-attached event references a session absent from the connection registry.
Error message
Session {value} was not created.
{value} is replaced by the value shown in your error message.
How this error happens
A target-attached event named a CDP session absent from Puppeteer’s registry. This can accompany session teardown or inconsistent browser/protocol event ordering.
The snippets use an open CDP-capable page named page. The first sequence illustrates a session lifecycle problem, not a guaranteed reproduction of an internal map failure.
const session = await page.createCDPSession();
await page.close();
await session.send(
"Runtime.evaluate",
{
expression: "1 + 1",
}
);
How to fix
Keep the page alive while using its session and clean up in order. Run the correction on a new open page.
const session = await page.createCDPSession();
try {
const result = await session.send(
"Runtime.evaluate",
{
expression: "1 + 1",
}
);
console.log(result.result.value);
} finally {
await session.detach();
await page.close();
}
Things to keep in mind
The closure example can produce a session-closed error before reaching this particular registry check. If the exact error occurs without teardown, isolate custom transports, plugins and manual target-attachment commands. Do not supply guessed session IDs.