Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsSome links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
“Uncaught [object Object]” is a symptom, not a diagnosis. It can mean JavaScript threw a non-Error object that could not be rendered as a useful message. Capture the original exception and identify which operation triggered it before changing Chrome flags or versions. A historical TestCafe report tied a similar message to screenshot capture in one specific headless Chrome setup, but it does not establish a universal cause or fix.
What the error tells you—and what it does not
JavaScript exceptions are often instances of Error, which usually carry a readable message and stack trace. But code can throw other values, including plain objects. When an exception handler tries to turn such a value into text, the result may be unhelpful. Chromium test code demonstrates a case where a thrown object’s own toString also throws, resulting in the displayed text Uncaught [object Object].
That behavior explains how the text can occur; it does not prove that it explains your failure. The string does not name the failing application function, test assertion, browser operation, or automation framework. Nor does “headless” by itself establish that Chrome is at fault. The useful evidence is the original thrown value, its stack when available, and the exact action underway when it appeared.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteStart by answering two separate questions: where did the exception originate? and what operation was in progress? An exception from page JavaScript during navigation calls for a different investigation from an automation error during screenshot capture.
#1 Best Overall
Capture the original page exception
If you use Playwright, attach a pageerror listener before navigating or performing the action that fails. Playwright describes this event as occurring when “an uncaught exception happens within the page.” Logging the exception object and its standard fields is more useful than logging only a string produced by interpolation.
page.on('pageerror', exception => {
console.error('Uncaught page exception:', exception);
console.error('name:', exception?.name);
console.error('message:', exception?.message);
console.error('stack:', exception?.stack);
});
await page.goto('https://example.com');
// Run the interaction or capture that normally fails here.
Place the listener immediately after creating the page and before the first navigation or test action. Replace the example URL and add the actual interaction or screenshot call from your test. If the failure happens before the listener is installed, or outside page JavaScript, this event may not reveal it; use the corresponding error reporting provided by your framework for that layer.
For an object with useful enumerable fields, you can inspect those fields separately, but treat arbitrary thrown values cautiously: they may be circular, contain getters with side effects, or have a broken string conversion. Avoid relying on ${exception} or String(exception) as your only log. Preserve the original object in the console, and inspect its properties individually. If it is an ordinary object, a guarded inspection can help:
Rank #2
page.on('pageerror', exception => {
console.error('Original exception:', exception);
try {
console.error('Own property names:', Object.getOwnPropertyNames(exception));
for (const key of Object.getOwnPropertyNames(exception)) {
try {
console.error(`${key}:`, exception[key]);
} catch (propertyError) {
console.error(`${key}: <could not read property>`, propertyError);
}
}
} catch (inspectionError) {
console.error('Could not inspect exception properties:', inspectionError);
}
});
This is diagnostic code, not a guarantee that every custom object is safe to inspect. In particular, reading a property can execute a getter. If you do not trust the page code or the object, keep the original exception available and inspect it in a controlled debugging session instead of serializing it blindly.
Isolate the failing operation
Record the precise point at which the message appears. “The test fails in headless Chrome” is too broad to distinguish page code from browser automation. Use a minimal reproduction and note whether the error appears during:
- Navigation or page startup: capture page exceptions from the beginning of the page lifecycle and check whether the application throws before the test interacts with it.
- An interaction: identify the exact click, form submission, script evaluation, or other action immediately before the error.
- An assertion: distinguish a failed test expectation from an uncaught exception in the page. An assertion message and a page exception are different evidence.
- Screenshot capture: retain the capture warning or error, and any subsequent image-parser message. Determine whether the page exception preceded the capture failure or whether the capture operation itself is the first failing step.
Keep the original test output, including warnings that may seem secondary. A screenshot failure followed by a parser error can indicate that the image data was incomplete, but the parser message alone does not identify why capture failed. Compare the order and timestamps of the messages rather than treating the last line as the root cause.
Rank #3
Record the environment before changing it
A reproducible report needs enough detail for someone else to run the same case. Record the framework and version, Node.js version, Chrome or Chromium version, operating system, whether the browser is headless or headed, launch flags, and the exact test and action that fail. Include the page or a minimal substitute if it can be shared safely.
Free tools Windows power users keep installed
One-click scans. No signup required.
This matters because a matching historical TestCafe report described a specific combination: TestCafe 2.1.0, Node.js 18.12.1, Chrome 108.0.5359.94, and macOS 10.15.7. Its reproduction steps described Node.js 17, 18, or 19, and the report concerned screenshot capture in headless Chrome. For TestCafe versions below 2.0.1, the reported behavior was different: a warning that the screenshot could not be taken, followed by a PNG parser “Unexpected end of input” error. Those are details of that report, opened December 7, 2022—not evidence that every current occurrence shares its cause or remedy.
Do not infer a current upgrade, downgrade, or launch flag from that case alone. Its value is that it demonstrates why framework version, runtime, browser, OS, and the failing operation belong in the diagnosis.
Rank #4
Reduce the case and compare one variable at a time
- Reproduce it reliably. Run the same test more than once and note whether the failure is consistent, intermittent, or tied to a particular page state. Preserve the exact first error and the action that triggers it.
- Trim the test. Remove unrelated assertions, setup hooks, and application interactions until the smallest test that still fails remains. If possible, use a minimal page to distinguish application behavior from framework or browser-operation behavior.
- Compare the relevant layers. Change one axis at a time: page code versus runner operation, screenshot versus navigation or interaction, headless versus headed mode, framework/Node.js/Chrome versions, or operating system. Record the result of each comparison.
- Recheck the exception. After a change, verify whether the thrown value, stack, and failing operation changed—not just whether the final test happened to pass once.
A headed run that succeeds while a headless run fails narrows the conditions, but does not by itself prove a Chrome defect. Likewise, a version change that makes the error disappear is useful evidence, not a complete explanation unless the reproduction and changed component are clear. Avoid changing several versions and flags together: if the result changes, you will not know which change mattered.
Fix the layer that actually throws
If application code throws a plain object
Prefer throwing an Error with a meaningful message and stack rather than a bare object. Keep structured details on the error when useful, so logs retain both a standard exception trace and the relevant data.
const error = new Error('Unable to save the record');
error.code = 'SAVE_FAILED';
error.details = { recordId };
throw error;
Use an appropriate error message and preserve the original cause when handling a lower-level failure. Do not replace an informative exception with an empty object or a generic string. If the application receives an object from an API, validate and report its fields explicitly; do not assume throwing that object will produce a useful browser stack.
Best Value
If the page exception is not the failure
If the page has no relevant uncaught exception and the first failure occurs inside a framework operation—such as screenshot capture—focus on that operation’s diagnostics and compatibility with the recorded runtime. Keep its warning and full error output, then use the reduced reproduction to investigate. Do not label Chrome as the cause merely because the browser was running headlessly.
If the exception is from page code but the source is unclear
Use the stack, message, and inspected properties to identify the code path that created the thrown value. Reproduce with the smallest page and action that still triggers it. If the exception has no useful stack because a non-Error value was thrown, improve the throwing code so future failures use a meaningful Error. That improves diagnosis; it does not retroactively prove which line caused an existing report when no stack or reproduction is available.
Troubleshooting by symptom
| What you observe | What it suggests | Next step |
|---|---|---|
| The message appears while the page loads or an interaction runs. | A page-side uncaught exception is possible; the displayed string is not enough to identify its source. | Install the page-error listener before navigation, preserve the exception object, and reduce the page and action. |
| The first failure is a screenshot warning, followed by a PNG parser error. | The captured image data may be incomplete, but the parser message does not establish why capture failed. | Keep both messages, establish their order, and isolate screenshot capture from page navigation and interactions. |
| The same test works headed but fails headless. | The mode is a relevant condition, not proof of a browser bug. | Keep the page, action, versions, OS, and flags constant while comparing modes. |
| Changing framework, Node.js, browser, and flags together appears to fix it. | The reproduction changed, but the responsible change is unknown. | Return to a controlled case and vary one component at a time. |
The console displays only [object Object]. |
String conversion may be hiding fields or stack information. | Log the original value and inspect its name, message, stack, and safe properties instead of relying on interpolation. |
Performance, reliability, and cost considerations
For local diagnosis, the most reliable approach is to preserve the failure context while reducing unrelated work: keep the same operation, attach logging early, and avoid changing several runtime variables at once. An additional page-error listener adds diagnostic logging, so remove or reduce verbose inspection after the issue is understood, especially if the test handles sensitive page data. The reviewed evidence does not establish a general performance penalty, a prevalence rate, or a universal reliability fix for this message.
If the task is simply to obtain a website screenshot and you do not need to exercise your own browser automation code, a screenshot API can avoid maintaining a local headless-browser capture setup. That is a change in approach, not a repair for an underlying JavaScript exception in your application or test.
Or skip the browser setup
ScreenshotNeo is a website screenshot API and MCP server. For a direct capture, make one GET request with the target URL; this cURL example saves a WebP image. See the ScreenshotNeo API documentation for the request options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts cookie or consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The free plan includes 1,000 shots a month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

