Puppeteer: Missing 'stream'
A tracing-complete event has no expected protocol stream handle.
A tracing-complete event has no expected protocol stream handle.
Error message
Missing 'stream'
How this error happens
The tracing-complete event did not contain the stream handle required to read the trace.
The snippets use an open Chrome/CDP page named page.
await page.tracing.start();
await page.setContent(
"<p>Trace this page</p>"
);
const trace = await page.tracing.stop();
How to fix
Keep tracing ownership in one place and keep the page connection alive until stop has read the stream. Remove competing raw tracing commands while reproducing.
await page.tracing.start();
try {
await page.setContent(
"<p>Trace this page</p>"
);
} finally {
const trace = await page.tracing.stop();
console.log(trace?.byteLength);
}
Things to keep in mind
The first sequence is valid and requires a faulty tracing event or reader to produce this error. The corrected lifecycle rules out missing cleanup ownership but cannot invent a stream the browser failed to return. Retain the original cause and stack if it persists.