“Target closed” is a symptom, not a diagnosis. Puppeteer is reporting that the Chrome page, browser process, or DevTools target disappeared before the next protocol command completed. In Docker, the underlying cause is commonly a browser startup failure caused by missing Linux libraries, an unusable sandbox, unwritable profile directories, an incompatible browser build, or a crash during navigation or rendering.
Start by capturing Chrome’s own stderr, then verify dependencies, sandboxing, writable paths, versions, and container resources in that order. Do not begin by adding a bundle of Chrome flags: the correct fix depends on why the target exited.
What the error actually means
Puppeteer communicates with Chrome through the Chrome DevTools Protocol. A “Target closed” message means the target no longer exists when Puppeteer tries to send a command. The target may be a page, a browser context, or the browser process itself. The message does not tell you whether Chrome failed before launch, crashed during a job, or was terminated by the container.
The same symptom can appear at puppeteer.launch(), browser.newPage(), navigation, screenshots, or PDF generation. Record the exact operation and the complete stack trace before changing configuration.
#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.
1. Record the environment before changing it
Capture these facts from the failing image and application:
- Node.js and Puppeteer versions from the lockfile or package manifest.
- The executable path and actual Chrome or Chromium version.
- Docker base image, Linux distribution, CPU architecture, and the user that runs Chrome.
- The complete error stack, including whether it mentions
Target.setDiscoverTargets, a page target, or a browser disconnect. - The first failing awaited call: launch, page creation, navigation, screenshot, or PDF.
- Container memory limits, shared-memory settings, mounted volumes, and filesystem read-only policies.
These details matter because Puppeteer’s browser requirements vary by release and image. A historical report used Puppeteer 5.2.1, Node 12.18.2, and a node:erbium-slim image; that combination is an example of an old environment, not a current Dockerfile to copy.
2. Expose Chrome’s own logs
Enable browser output temporarily so the failure that caused the target to disappear is visible:
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch({
dumpio: true
});
try {
const page = await browser.newPage();
await page.goto('https://example.com', {waitUntil: 'networkidle2'});
await page.screenshot({path: '/tmp/example.png', fullPage: true});
} finally {
await browser.close();
}
})();
Puppeteer’s debugging guidance says dumpio: true forwards browser stdout and stderr to the Node process. Look for messages about a missing .so library, “No usable sandbox,” profile or crashpad creation failures, or an explicit browser crash. If the browser output is inconclusive, enable DevTools protocol tracing with the environment variable NODE_DEBUG="puppeteer:*". Logs can contain URLs, headers, cookies, or page data, so restrict access and redact them before sharing.
Recommended Free Tools
3. Check missing Linux libraries
Minimal images often omit libraries that Chrome needs even though Node and Puppeteer install successfully. In the running container, locate the executable that Puppeteer actually launches and inspect unresolved dependencies:
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.
which google-chrome || which chromium || which chromium-browser
ldd /path/to/your/chrome | grep not
Replace the path with the result of your executable check. If ldd reports a missing library, install the distribution package that provides it, rebuild the image, and retest that same image. Puppeteer’s troubleshooting guidance includes Debian/Ubuntu dependency examples, but the required packages depend on the browser and what your base image already contains. Do not paste a Debian package list into Alpine or another distribution.
A concrete missing-library pattern
In one historical Docker report, Chrome could not load libgobject-2.0.so.0. Puppeteer surfaced the failure as Protocol error (Target.setDiscoverTargets): Target closed, especially when using a pipe connection. The lesson is diagnostic: browser stderr and dependency inspection are more useful than treating Target.setDiscoverTargets as a special Puppeteer bug. The report is old and does not prove that the same library is missing from your image.
4. Verify sandboxing safely
Chrome is designed to run with a sandbox. Puppeteer’s official guidance recommends configuring a usable sandbox and strongly discourages disabling it. First inspect stderr for a sandbox error such as “No usable sandbox!” and determine whether your container can run Chrome with the required user namespaces or sandbox setup.
--no-sandbox removes an important security boundary. Puppeteer documents it only for cases where you absolutely trust all content opened in Chrome. It is not a routine Docker fix and should never be added merely because the error text says “Target closed.” If you must use it for a tightly isolated, trusted workload, document the risk, limit outbound access, avoid untrusted URLs, and plan a sandboxed deployment instead.
5. Give Chrome writable profile and cache paths
Chrome writes profile, configuration, cache, and crash-report files while starting and browsing. A read-only root filesystem, an incorrectly owned mount, or a restricted temporary directory can make Chrome exit immediately.
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.
For a disposable job, direct XDG paths and Puppeteer’s user data directory to a writable temporary location:
const browser = await puppeteer.launch({
dumpio: true,
userDataDir: '/tmp/puppeteer-profile'
});
Set XDG_CONFIG_HOME and XDG_CACHE_HOME to writable directories in the container environment when your image policy requires it. Alternatively, mount a writable volume and ensure its ownership matches the user running Chrome. A persistent volume can retain data between jobs; a per-job directory reduces cross-job contamination. Delete temporary profiles after the browser closes, and do not share one profile concurrently between workers.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware match6. Separate launch failures from late target exits
Add a log line around every awaited browser operation. If launch() never resolves, concentrate on dependencies, sandboxing, executable selection, and writable paths. If launch succeeds and a later call fails, correlate browser stderr with that operation:
console.log('launching');
const browser = await puppeteer.launch({dumpio: true});
console.log('launched');
const page = await browser.newPage();
console.log('page created');
await page.goto(url, {waitUntil: 'domcontentloaded'});
console.log('navigation complete');
await page.pdf({path: '/tmp/output.pdf'});
console.log('pdf complete');
A target can close during heavy navigation, JavaScript execution, screenshot, or PDF rendering. Check the container’s memory and CPU limits while reproducing the workload. Out-of-memory termination is possible, but the generic error does not prove it. Reduce concurrency or increase limits only when measurements and container events indicate resource pressure. Also check whether an orchestrator is killing the process, whether a job timeout expires, or whether application code closes the browser in a cleanup path before another task uses it.
7. Align Puppeteer, browser, image, and architecture
Determine whether the application uses Puppeteer’s bundled Chrome for Testing or a separately installed Chromium. Puppeteer documents that it is guaranteed to work with its bundled browser; a system browser requires deliberate compatibility checking. Confirm the executable path and print the browser version from inside the image rather than relying on the host.
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
Alpine deserves special attention: Chrome does not work on Alpine out of the box, and its libraries and compatibility setup differ from Debian or Ubuntu. If you choose Alpine, follow a dependency plan appropriate to the exact browser build and architecture. A Debian-based image may reduce package friction, but it still needs the libraries required by your selected Chrome.
Puppeteer’s changelog snapshot dated 2026-09-23 lists version 25.12.0 and Chrome for Testing 154.0.8037.57. That is a dated release fact, not a universal upgrade recommendation. Use your lockfile, release notes, and installed executable when deciding whether to upgrade or pin versions. Change one variable at a time so a successful test identifies the cause.
Choosing a reliable container arrangement
Bundled Chrome for Testing
The bundled browser keeps Puppeteer and Chrome versions aligned and makes the dependency set reproducible. You still must build an image containing the browser’s shared libraries and provide suitable sandbox and writable paths.
System Chromium
A system package can fit an organization’s base image and patching process, but its release may move independently of Puppeteer. Record the package version, executable path, and architecture, and test after image updates.
Temporary directory or writable volume
A temporary directory is simple for isolated jobs and avoids stale profiles. A mounted volume is useful when policy requires an explicit writable location or when you need controlled persistence. In both cases, verify ownership and available space.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →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.
Common non-fixes and when they apply
--disable-dev-shm-usage: do not assume it fixes every closure. Use it only when diagnostics show a shared-memory constraint and understand the performance trade-off of moving temporary data elsewhere.--no-sandbox: not a default solution; it reduces isolation and is strongly discouraged except for absolutely trusted content.--single-processor large flag bundles: flags can hide the original failure, create new instability, or make behavior differ from production. Add a flag only for a diagnosed requirement.- Blindly increasing memory: measure first. A target closure can result from missing libraries, permissions, version mismatch, or application logic instead.
- Copying an old Dockerfile: package names and browser versions are distribution- and release-specific. Rebuild from your current base image and inspect its actual dependencies.
Or skip the browser setup
If your goal is to obtain a website screenshot rather than operate Chrome inside your own container, ScreenshotNeo provides a single HTTP request and an MCP server for AI agents. It removes cookie and consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and response headers identify the page verdict and billing status. Claude, Cursor, and other MCP clients can use take_screenshot, get_page_info, and capture_pdf.
Use the API documentation at https://screenshotneo.com/docs/ for all options. A cURL request:
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 supports full-page and element captures, device presets and custom viewports, retina scale, dark mode, PDF settings, custom CSS and JavaScript, clicks, waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, caching, signed links, asynchronous webhooks, bulk capture, usage reporting, and an OpenAPI specification. Its parameter names also accept the names used by other screenshot APIs, which can simplify migration.
The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account to try it.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Performance and reliability practices
- Reuse a healthy browser for multiple pages when isolation requirements permit, but create separate contexts or workers for untrusted jobs.
- Limit concurrent pages according to measured CPU, memory, and rendering time rather than a guessed worker count.
- Use explicit navigation timeouts and log the URL and operation that was active when a target closed.
- Keep browser and image versions pinned, then update them deliberately with a smoke test for launch, navigation, screenshot, and PDF.
- Clean temporary profiles and verify free disk space; a full writable volume can look like a browser crash.
- Collect container exit codes and orchestrator events alongside Puppeteer logs. A process killed outside Node will not produce a useful Puppeteer exception by itself.
Diagnostic checklist
- Reproduce with
dumpio: trueand save the complete stderr. - Identify the exact executable, browser version, Puppeteer version, image, architecture, and failing operation.
- Run
ldd chrome | grep notagainst that executable and install only the packages required by the image’s distribution. - Resolve sandbox errors without disabling the sandbox unless the content is absolutely trusted and the risk is accepted.
- Make profile, XDG, cache, and temporary paths writable by the Chrome user.
- Check memory, CPU, shared memory, disk, job timeouts, and orchestrator termination during the failing workload.
- Retest with one controlled change, then remove diagnostic flags and keep the smallest configuration that works.
Frequently Asked Questions
Does “Target closed” always mean the container ran out of memory?
No. Memory pressure is one possible cause of a late browser exit, but missing libraries, sandbox failures, unwritable paths, version mismatches, and application lifecycle bugs can produce the same message.
Should I switch to Chromium instead of Chrome?
Not automatically. First determine which browser Puppeteer launches and whether its version and Linux dependencies match your image. Switching browsers without checking compatibility can replace one failure with another.
Is a read-only Docker filesystem incompatible with Puppeteer?
Not necessarily, but Chrome still needs writable locations for its profile, configuration, cache, and temporary files. Provide correctly owned writable paths or a volume and verify them inside the container.
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.

