Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Next.js and React

Puppeteer prints a yellow old Headless warning every time it launches

Your error

Puppeteer old Headless deprecation warning:2 more lines it can show

Fix it fast

Most common cause, 1 of 3

The project runs Puppeteer 19.11 to 21.x, where true still meant the old mode

Move to the current major.

Fix
npm install puppeteer@latest

// launch code for Puppeteer 22 and later
const browser = await puppeteer.launch({ headless: true });
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

Puppeteer 19.11 to 21.x prints the old Headless deprecation warning when headless is true or left out, because in those releases true still started Chrome's old Headless mode. Upgrade to Puppeteer 22 or later (25.18 now), where true already means the new mode, and remove any headless: 'new'. Pick headless: 'shell' only to keep the old chrome-headless-shell behaviour.

  • Applies to Puppeteer 25.18.1, Puppeteer 19.11 to 21.11 (the releases that print the warning), Chrome 132 and later
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

Ask npm which Puppeteer the project really resolves, then list every line that sets a headless value or flag. Below 22 means cause 1. Version 22 or newer with 'new' in the code means cause 2. A --headless=old argument means cause 3.

Run this first
npm ls puppeteer puppeteer-core
grep -rnE "headless" --include=*.js --include=*.mjs --include=*.cjs --include=*.ts --exclude-dir=node_modules .

Then find the line you see in this list and open its fix:

  1. 1The project runs Puppeteer 19.11 to 21.x, where true still meant the old modenpm ls prints a 19.11, 20.x or 21.x version, and launch() gets headless: true or no headless option at all
  2. 2The code was upgraded but still passes headless: 'new'Puppeteer is 22 or newer, and the TypeScript compiler complains about the headless line
  3. 3The script forces old Headless with a --headless=old Chrome flagThe launch args contain --headless=old, and the browser stopped starting in old Headless after a Chrome update

What does the error look like?

  • Puppeteer old Headless deprecation warning:
  • In the near future `headless: true` will default to the new Headless mode for Chrome instead of the old Headless implementation.
  • Consider opting in early by passing `headless: "new"` to `puppeteer.launch()`

Cause 1 of 3

The project runs Puppeteer 19.11 to 21.x, where true still meant the old mode

You seenpm ls prints a 19.11, 20.x or 21.x version, and launch() gets headless: true or no headless option at all

Check

The old Headless deprecation warning is printed by the Chrome launcher of Puppeteer 19.11 to 21.x whenever headless resolves to true. An empty launch() resolves to true as well, so the plain default call shows it. Release 22.0.0 lists the new Headless mode becoming the default as a breaking change.

Check
npm ls puppeteer

Fix

Move to the current major. From 22.0.0 on, true starts the new Headless mode and no warning is printed. The same release renamed createIncognitoBrowserContext to createBrowserContext and removed $x, so read the breaking changes first. When the upgrade has to wait, passing headless: 'new' on the old version opts in early, and setting PUPPETEER_DISABLE_HEADLESS_WARNING to any value hides the block.

Fix
npm install puppeteer@latest

// launch code for Puppeteer 22 and later
const browser = await puppeteer.launch({ headless: true });

Verify

npm ls now shows 25.x, and a launch prints nothing in yellow before your own output.

Verify
npm ls puppeteer
node index.js

Confirmed by raw.githubusercontent.com

Did this fix it?

Cause 2 of 3

The code was upgraded but still passes headless: 'new'

You seePuppeteer is 22 or newer, and the TypeScript compiler complains about the headless line

Check

The 'new' value only existed so people could opt in before the switch. In the current LaunchOptions reference, headless accepts boolean | 'shell', where true is the new mode and 'shell' is the old one. A leftover 'new' no longer matches that type, so a TypeScript build stops there.

Check
grep -rn "headless: *['\"]new" --include=*.ts --include=*.js --exclude-dir=node_modules .

Fix

Change 'new' to true, or delete the option, since true is already the default.

Fix
// Puppeteer 19.11 to 21.x opt-in
// const browser = await puppeteer.launch({ headless: 'new' });

// Puppeteer 22 and later
const browser = await puppeteer.launch({ headless: true });

Verify

The type check finishes with no error on the launch call.

Verify
npx tsc --noEmit

Confirmed by pptr.dev

Did this fix it?

Cause 3 of 3

The script forces old Headless with a --headless=old Chrome flag

You seeThe launch args contain --headless=old, and the browser stopped starting in old Headless after a Chrome update

Check

Chrome 132 took the old Headless mode out of the Chrome binary. From that release, --headless=old prints an error message instead of starting a browser. The old implementation survives only as the standalone chrome-headless-shell binary.

Check
grep -rn "headless=old" --exclude-dir=node_modules .

Fix

Delete the flag and let Puppeteer choose the binary. headless: true gives the new mode inside Chrome. headless: 'shell' gives chrome-headless-shell, which Puppeteer's guide calls more performant for automation that does not need the full Chrome feature set. Puppeteer downloads the shell at install time; if CI sets PUPPETEER_SKIP_CHROME_HEADLESS_SHELL_DOWNLOAD, remove it and fetch the browsers again.

Fix
// delete args: ['--headless=old'] and ask for the shell instead
const browser = await puppeteer.launch({ headless: 'shell' });

Verify

After the browsers install step, the script launches, takes its screenshot or PDF, and exits without the Chrome error.

Verify
npx puppeteer browsers install
node index.js

Confirmed by developer.chrome.com

Did this fix it?

How do I stop it coming back?

  • Pin puppeteer to an exact version and read the BREAKING CHANGES list in its changelog before every major bump.
  • Create the browser in one shared launch helper so a headless change is a single edit.
  • Add a type-check step (npx tsc --noEmit) to every pull request, so an option value Puppeteer dropped breaks the build early rather than a nightly job.
  • Leave the chrome-headless-shell download switched on in CI images whenever any job uses headless: 'shell'.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.