“Navigation failed because browser has disconnected” means Puppeteer lost its connection to the browser while it was waiting for navigation. The browser may have closed, crashed, or been intentionally detached with browser.disconnect(). The message does not identify which of those happened, so the reliable fix is to capture lifecycle, Node.js, page, browser, and deployment evidence before changing wait options or launch flags.
What the error actually tells you
Puppeteer emits its disconnected event when it is no longer connected to a browser instance. The documented causes include the browser closing, the browser crashing, or your code calling Browser.disconnect() (Puppeteer BrowserEvent documentation). A navigation promise that is still pending then rejects with the familiar error.
That distinction matters: a selector timeout, an HTTP error, and a browser disconnect are different failures. Do not treat the text as proof that the target website, TLS, networkidle0, or a particular Linux distribution is at fault.
First, prove what ended the connection
Log the disconnect with request context
Attach the listener immediately after launching the browser. Record the URL, job ID, timestamp, process ID, and whether cleanup has started.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({
headless: true,
dumpio: true
});
const page = await browser.newPage();
const targetUrl = 'https://example.com';
const jobId = crypto.randomUUID?.() || String(Date.now());
browser.on('disconnected', () => {
console.error(JSON.stringify({
event: 'browser-disconnected',
jobId,
targetUrl,
at: new Date().toISOString()
}));
});
page.on('console', message => {
console.log(`[page:${message.type()}] ${message.text()}`);
});
try {
await page.goto(targetUrl, { waitUntil: 'domcontentloaded', timeout: 45_000 });
console.log('Navigation completed');
} finally {
if (browser.connected()) {
await browser.close();
}
}
})();
If your Node version does not provide crypto.randomUUID() globally, import it with const { randomUUID } = require('node:crypto'). The important parts are the event listener, page-console logging, a bounded navigation timeout, and cleanup that cannot blindly run after a disconnect.
Audit every close and disconnect path
Search the application for browser.close(), browser.disconnect(), process signal handlers, job deadlines, health-check restarts, and finally blocks. browser.close() shuts down the browser. browser.disconnect() only detaches Puppeteer; the browser and its pages continue running (Puppeteer browser management).
A common race is a timeout or request handler executing cleanup while another promise is still navigating. Make ownership explicit: one component should close the browser, and it should do so only after all page work has settled. If a shared browser serves several jobs, never let one request call close() on a browser owned by other requests.
Collect evidence from all three layers
Puppeteer’s debugging guidance separates failures in your Node.js code, the page/client code, and the browser process (Puppeteer debugging guide). Capture all three for the same attempt.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Node.js and application layer
- Log uncaught exceptions and unhandled promise rejections at the process boundary.
- Record the Puppeteer package version, Node.js version, command-line arguments, URL, and job or request ID.
- Check whether an orchestrator sent
SIGTERMorSIGKILL, whether a request deadline expired, or whether a worker restarted. - Preserve the original error and stack; do not replace it with a generic timeout.
process.on('uncaughtException', error => {
console.error('uncaughtException', error);
});
process.on('unhandledRejection', reason => {
console.error('unhandledRejection', reason);
});
Page layer
Use page.on('console'), page.on('pageerror'), and request/response logging selectively. A page-side exception normally does not close Chromium, but it can reveal scripts that trigger redirects, reload loops, or an application-specific shutdown path.
page.on('pageerror', error => console.error('pageerror', error));
page.on('requestfailed', request => {
console.error('requestfailed', request.url(), request.failure());
});
Browser-process layer
Launch a controlled diagnostic run with dumpio: true so Chromium’s stdout and stderr reach your process. On a local machine, headless: false can show whether the browser window disappears, crashes, or is redirected. Debug output can contain URLs, headers, page content, or other sensitive data; redact it before sharing.
Check versions, executable paths, and the runtime
Record the installed Puppeteer version and browser revision, Node.js version, operating system, container or serverless runtime, launch arguments, and any custom executablePath. Puppeteer’s launch documentation guarantees support for its bundled browser and places custom executables at the user’s risk (LaunchOptions). A mismatch is therefore a compatibility hypothesis to verify, not a universal explanation.
Compare a successful local run with the failing deployment. Check:
Recommended Free Tools
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
- Container or function memory and CPU limits, plus the process exit reason.
- Concurrency: whether several jobs share one browser, profile directory, or temporary directory.
- Writable temporary and user-data directories, including available disk space.
- Container signals and graceful-shutdown behavior.
- Whether a supervisor kills workers that exceed a request or job timeout.
- Whether the configured executable actually exists and starts under the deployment user.
Do not copy --no-sandbox, --single-process, memory changes, or other flags from an issue thread without evidence that your environment needs them. Historical reports involving SSL resources, Ubuntu/kernel combinations, containers, and AWS Lambda demonstrate that symptoms vary; they do not establish a general fix (Puppeteer issue tracker).
Use navigation waits correctly
Understand networkidle0 and networkidle2
networkidle0 resolves after there are no more than zero active network connections for at least 500 ms. networkidle2 allows up to two connections for the same interval (Puppeteer lifecycle events). These are completion conditions, not crash prevention. Analytics, WebSockets, polling, advertisements, or a long-lived request can prevent the condition from being reached, but changing it does not explain a browser that has already disconnected.
Choose the earliest condition that represents useful readiness:
domcontentloadedwhen the document structure is enough.loadwhen resources required by your task should be loaded.networkidle2for pages with a small amount of continuing traffic.networkidle0only when true network quiescence is expected.
await page.goto(url, {
waitUntil: 'domcontentloaded',
timeout: 45_000
});
await page.waitForSelector('#report', { timeout: 15_000 });
Avoid navigation races
When a click causes navigation, start the wait and the click together:
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
await Promise.all([
page.waitForNavigation({ waitUntil: 'domcontentloaded', timeout: 45_000 }),
page.click('a.next')
]);
Starting page.click() first and only then calling waitForNavigation() can miss a fast navigation. Conversely, adding a second waiter when the code performs only one navigation creates confusing pending promises. The current Page documentation discusses this race pattern (Page API).
Keep setContent and navigation separate
page.setContent() loads supplied HTML; it is not a replacement for page.goto(). If you call setContent with a network-idle wait and also retain a separate waitForNavigation(), verify that two real navigations exist. A historical Lambda report combined those operations; it is useful for reproducing a pattern, not proof that either wait option is a universal cause.
Build a minimal reproduction
- Install the exact Puppeteer version used in the failing application and use its supported bundled browser.
- Launch one browser and create one page with the same headless mode and executable path.
- Navigate to the same URL, or call
setContentwith the same HTML, using the original wait condition. - Enable
dumpio, the disconnect listener, page console/error listeners, and process-level error logging. - Run the case repeatedly locally, then in the deployment with one worker and no concurrency.
- Add authentication, request interception, custom headers, shared profiles, and parallel jobs one at a time.
This isolates whether the trigger is application lifecycle, page behavior, browser compatibility, resource pressure, or the deployment runtime. Include the minimal script, exact versions, operating system, launch options, and sanitized logs when asking for help.
Common symptoms and targeted fixes
| Symptom | Likely area to test | Action |
|---|---|---|
| Disconnect occurs exactly when a request times out | Application cleanup | Trace timeout handlers and finally blocks; ensure they do not close a browser still serving another operation. |
| Browser exits with an OS or container kill message | Runtime resources | Check memory, CPU, disk, process limits, and supervisor events; reproduce with one page and one worker. |
| Only a custom executable fails | Browser/Puppeteer compatibility | Test the bundled browser, verify the executable path and permissions, and compare versions. |
| Local succeeds but CI or serverless fails | Deployment assumptions | Compare signals, limits, writable directories, concurrency, and startup arguments; capture browser stderr with dumpio. |
networkidle0 never resolves |
Wait condition | Inspect persistent requests and use a selector or a more suitable lifecycle condition; do not treat this alone as evidence of a disconnect. |
| Disconnect follows a click or form submission | Navigation race | Pair the action and waitForNavigation() in Promise.all, and confirm the action really navigates. |
Reliability practices for production
- Use a per-job timeout and abort work before the platform forcibly terminates the process.
- Give each job a clear browser/page owner; avoid closing shared browsers from request-level cleanup.
- Prefer a fresh page per job and an isolated profile when state can leak between jobs.
- Record browser connection state before cleanup and make cleanup idempotent.
- Limit concurrency based on measured resource behavior rather than a copied launch flag.
- Keep diagnostic logging configurable and redact credentials, cookies, authorization headers, and private URLs.
- Pin versions in deployment and re-check current compatibility documentation when upgrading; Puppeteer’s API versions and supported browser revisions change.
Or skip the browser setup
If your goal is simply to obtain a clean website image or PDF rather than debug Puppeteer, ScreenshotNeo provides a one-request screenshot API and an MCP server for AI agents. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and each response identifies the result with X-Page-Verdict and X-Billed headers.
Example cURL request (see the ScreenshotNeo API documentation):
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
ScreenshotNeo also offers full-page and element captures, device and retina settings, dark mode, PDF controls, custom CSS and JavaScript, selector waits, request blocking, headers and cookies, geolocation and timezone, transparent backgrounds, resizing, configurable caching, signed links, asynchronous webhooks, bulk capture for up to 100 URLs per call, usage data, and an OpenAPI specification. Its MCP tools are take_screenshot, get_page_info, and capture_pdf.
The Free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.
When to escalate
Escalate with a minimal reproduction when the browser disconnects with the bundled browser, one page, one worker, stable resource limits, and no application cleanup path. Provide sanitized stderr, process-exit information, exact versions, operating system/runtime details, launch options, and the navigation code. That evidence lets maintainers distinguish a Puppeteer regression from an environment or lifecycle bug.
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 →Frequently Asked Questions
Does changing waitUntil fix a browser disconnect?
No. It changes when Puppeteer considers navigation complete. A disconnect still requires checking browser lifecycle, process exits, cleanup, and runtime logs.
Should I always use --no-sandbox in CI?
No. Treat launch flags as environment-specific changes and add one only when your runtime and logs show why it is required.
What is the difference between closing and disconnecting?
browser.close() shuts down the browser. browser.disconnect() detaches Puppeteer while leaving the browser and pages running.
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.

