(Created on )

Puppeteer: Unknown error: {value}

Tracing failed with a non-Error value, which Puppeteer wraps as Unknown error.


Tracing failed with a non-Error value, which Puppeteer wraps as Unknown error.

Error message

Unknown error: {value}

{value} is replaced by the value shown in your error message.

How this error happens

Reading the trace stream failed with a thrown value that was not an Error, so Puppeteer wrapped it as an unknown error.

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.

All Puppeteer errors

Keep Reading

Puppeteer Guides

All Guides →