Skip to content
Guide

rebrowser-patches Not Working in 2026: Patch Errors, Fix Modes and Cloudflare

NSLSolver TeamPublished Updated 12 min read

rebrowser-patches usually stops working for one of three reasons: the patch does not match your Puppeteer or Playwright version, your package manager quietly put the unpatched library back, or the patches worked and Cloudflare is blocking you on signals they never touch: headless mode, fingerprint, IP and behaviour. The README says the fix "alone won't make your browser bulletproof and undetectable".

Fix it in this order: move to the latest drop-ins (rebrowser-puppeteer 25.16.0 and rebrowser-playwright 1.64.102, released 2 November 2026), confirm on rebrowser-bot-detector that the patched code is loaded, then fix the environment. If a Turnstile widget or "Just a moment..." page still never clears, take that step out of the browser.

Quick answer: match your rebrowser error to the fix

These are the messages and symptoms people hit most with rebrowser-patches and its drop-in packages. Find yours, then read the matching section below.

❌ FATAL ERROR: The closest patch (…) does not apply to puppeteer-core@…
The patcher has no patch for your exact library version and the nearest one does not fit. Install a tested version (puppeteer-core 25.16.0, playwright-core 1.64.1) or switch to the drop-in package.
patch command not found!
Windows has no GNU patch binary, which the CLI calls. Install Git for Windows and add C:\Program Files\Git\usr\bin to PATH, or use the drop-ins.
[rebrowser-patches] acquireContextId failed (tryAgain = true, tryCount = 3)
Older patches failed on pages that redefine the global self, and on MetaMask extension pages (#100, #116, #59). Upgrade to rebrowser-puppeteer 25.16.0 or rebrowser-playwright 1.64.102; the fix shipped in 1.1.1.
bot-detector still shows runtimeEnableLeak after installing the drop-in
The unpatched core loaded: npm install undid a CLI patch, or the pre-1.1.1 alias resolved to stock playwright-core (#74). Upgrade, check npm ls, re-patch after installs.
TypeError: Cannot read properties of undefined (reading 'get') at Frame._onClearLifecycle
Older rebrowser-playwright crashed on Firefox and WebKit (#112). Upgrade to 1.64.1 or later, which skips the Chromium-only code on those browsers.
Execution context was destroyed, most likely because of a navigation
Older patches dropped contexts too eagerly (#115) and lost waits created before a navigation (#129). Upgrade to the 1.1.1 builds or newer; both have regression tests now.
page.pause() does nothing with rebrowser-playwright
A documented limitation of the Runtime.enable fix. Set REBROWSER_PATCHES_RUNTIME_FIX_MODE=0 while debugging.
Cloudflare "Verify you are human" checkbox comes back after every click
Not a patch bug: the maintainer saw the same loop with stock Puppeteer and Playwright (#104). Fix headless mode, IP and VM signals, or get the token or cf_clearance from a solver API.

Error strings are quoted from the rebrowser-patches patcher source and GitHub issues; versions from npm, PyPI and the GitHub releases page, all checked on 2026-12-01.

How rebrowser-patches works

rebrowser-patches is an MIT-licensed project maintained by Rebrowser (about 1,500 GitHub stars on 2026-12-01, not archived). It edits the source of puppeteer-core and playwright-core, an approach the README calls "fragile" because upstream code keeps changing. You either run the npx rebrowser-patches CLI against your installed library or install the pre-patched drop-ins: rebrowser-puppeteer(-core) and rebrowser-playwright(-core) on npm, and rebrowser-playwright on PyPI, all Apache-2.0 like upstream.

The main patch removes the Runtime.enable leak. Puppeteer and Playwright send this CDP command to track execution contexts, and page JavaScript can detect it; the README says all major anti-bot vendors, Cloudflare and DataDome included, check for it. The patched code finds the context ID another way. Other patches drop Puppeteer's pptr: sourceURL, rename Playwright's UtilityScript helper and the utility world, add --disable-blink-features=AutomationControlled so navigator.webdriver is false, and remove --enable-automation, --disable-popup-blocking and --disable-ipc-flooding-protection.

Why rebrowser-patches stops working

  • Version drift. The CLI ships one patch per upstream version. Between 1.0.19 (9 May 2025, Puppeteer 24.8.1, Playwright 1.52.0) and 1.1.0 (17 October 2026) nothing was released, so newer versions had no matching patch for about 17 months.
  • Reinstalls. The README warns that npm install or yarn install can overwrite the patched files, so a CLI patch disappears on the next deploy.
  • The alias trap. Before 1.1.1, if the original playwright or puppeteer of the same version was also installed, npm silently gave the drop-in the unpatched core (issue #74).
  • Page-specific bugs. Older builds threw acquireContextId failed on pages that redefine the global self (#100, #116) and lost waits across navigations (#129), all fixed in 1.1.1.
  • Out-of-scope signals. The patches do not touch the HeadlessChrome user-agent token, canvas, WebGL, fonts, screen, IP reputation or timing, and the README says Turnstile scores all of these.
  • Extra stealth layers. Adding puppeteer-extra-plugin-stealth turns the detector's nativeTampering and workerConsistency checks red, per the README.

Fix 1: install the drop-in packages the right way

Use the npm alias so imports stay the same, and always take the newest drop-in rather than matching your upstream version: fixes to a released version ship as X.Y.100, X.Y.101 and so on. Since 1.1.1 the drop-ins depend on their -core packages by real name, which closes the #74 trap, but check with npm ls anyway.

Two requirements catch people out: rebrowser-puppeteer 25.16.0 needs Node 22.12.0+, rebrowser-playwright Node 20+; and the drop-ins patch the library, not the browser, so Playwright still needs a browser install or channel: 'chrome'. In Python, install rebrowser-playwright 1.64.102 (Python 3.10+) and import from rebrowser_playwright.

install.sh
# Puppeteer (Node 22.12+): patched code under the original package names
npm install puppeteer@npm:rebrowser-puppeteer puppeteer-core@npm:rebrowser-puppeteer-core
# package.json now reads: "puppeteer": "npm:rebrowser-puppeteer@^25.16.0"

# Playwright (Node 20+)
npm install playwright@npm:rebrowser-playwright playwright-core@npm:rebrowser-playwright-core
npx playwright install chromium   # the drop-in patches the library, not the browser

# Confirm the patched core is what actually resolved (issue #74)
npm ls rebrowser-puppeteer-core rebrowser-playwright-core

# Python (3.10+): separate package, change the import
pip install -U rebrowser-playwright
rebrowser_playwright install chromium
#   from rebrowser_playwright.sync_api import sync_playwright

Fix 2: patcher CLI errors and version mismatches

The CLI accepts only puppeteer-core and playwright-core; --packageName puppeteer ends with "No lib.patch found for puppeteer". Release 1.1.3 carries patches for puppeteer-core 24.8.1, 25.14.0 and 25.16.0 and playwright-core 1.52.0 and 1.64.1. Without an exact match it tries the newest patch for the same major.minor, then the newest overall, and prints "No patch tested on …".

If that patch does not apply cleanly, it stops with "The closest patch (…) does not apply to …" and leaves your files alone: pin a tested version or use the drop-in. On Windows it needs GNU patch, which ships with Git. For Python, Java or .NET Playwright, point --packagePath at the bundled Node driver.

patch.sh
# Run in the project root, after npm install. Only puppeteer-core and
# playwright-core are supported package names.
npx rebrowser-patches@latest patch --packageName puppeteer-core
npx rebrowser-patches@latest check --packageName puppeteer-core    # patched or unpatched?
npx rebrowser-patches@latest unpatch --packageName puppeteer-core

npx rebrowser-patches@latest patch --packageName playwright-core

# Python / Java / .NET Playwright: patch the bundled Node driver instead
npx rebrowser-patches@latest patch --packagePath /path/to/driver/package

# npm install / yarn install can restore the original files: re-patch afterwards,
# e.g. "postinstall": "npx rebrowser-patches@latest patch --packageName puppeteer-core"

# Windows, "patch command not found!": Git for Windows ships patch.exe
set PATH=%PATH%;C:\Program Files\Git\usr\bin\

Fix 3: choose the fix mode and test on rebrowser-bot-detector

If a page works with stock Puppeteer but breaks with the patches, change the mode first. In the default addBinding mode page.evaluate runs in the main world, where a page that wraps document.querySelector can watch your calls (the detector's mainWorldExecution test); alwaysIsolated hides that but loses main-world access.

Then open bot-detector.rebrowser.net with your production launch options. It reports runtimeEnableLeak, sourceUrlLeak, navigatorWebdriver, viewport, headless, platformMismatch and more.

VariableValueUse it when
REBROWSER_PATCHES_RUNTIME_FIX_MODEaddBinding (default)Normal use: keeps main-world access, works with iframes and workers.
REBROWSER_PATCHES_RUNTIME_FIX_MODEalwaysIsolatedPage scripts must not see your code; you lose main-world access and page.exposeFunction().
REBROWSER_PATCHES_RUNTIME_FIX_MODEenableDisableNot recommended: briefly calls Runtime.enable. Only if addBinding fails on one page.
REBROWSER_PATCHES_RUNTIME_FIX_MODE0Debugging, e.g. page.pause() in Playwright. Turns the fix off.
REBROWSER_PATCHES_SOURCE_URLa full URL, or 0Puppeteer: set your own sourceURL; 0 disables the stack-trace patch.
REBROWSER_PATCHES_UTILITY_WORLD_NAMEa name, or 0Rename the utility world (default util). Set it before import.
REBROWSER_PATCHES_WEBDRIVER_FIX0Keep the library's default launch switches.
REBROWSER_PATCHES_DEBUG1Print debug messages, e.g. for acquireContextId failures.

From the rebrowser-patches README on 2026-12-01. The Playwright patch documents only the addBinding and alwaysIsolated modes.

check.mjs
// check.mjs - run with the SAME launch options you use in production:
//   REBROWSER_PATCHES_RUNTIME_FIX_MODE=alwaysIsolated xvfb-run node check.mjs
import puppeteer from 'puppeteer'; // resolves to rebrowser-puppeteer via the npm alias

const browser = await puppeteer.launch({
  headless: false,          // headful; on a server run it under Xvfb
  defaultViewport: null,    // the 800x600 default is flagged by the viewport test
  // executablePath: '/usr/bin/google-chrome',  // real Chrome, not Chrome for Testing
});
const page = await browser.newPage();
await page.goto('https://bot-detector.rebrowser.net/', { waitUntil: 'networkidle2' });

// false when the webdriver patch is active
console.log('navigator.webdriver =', await page.evaluate(() => navigator.webdriver));

await new Promise((resolve) => setTimeout(resolve, 3000)); // let the tests finish
await page.screenshot({ path: 'bot-detector.png', fullPage: true });
await browser.close();

Fix 4: Cloudflare still shows the challenge or the Turnstile checkbox

This is the most reported failure and usually not a patch bug. In issue #104 the Turnstile checkbox returned after every click on an Xvfb VM with both drop-ins. The maintainer saw the same loop with stock Puppeteer and Playwright and wrote that "Turnstile looks at far more than the CDP leak": IP reputation, VM signals such as software WebGL, and input events.

  • Run headful (Xvfb on a server) or new headless, never chrome-headless-shell; the patches leave the HeadlessChrome user-agent token in place.
  • Use real Chrome (channel: 'chrome' or executablePath), not Chrome for Testing, with a null viewport.
  • Do not fake the OS: a Windows user agent on Linux fails platformMismatch. Leave the stealth plugin out.
  • Test from a residential or mobile IP. A datacenter VM with no GPU is the hardest case.
  • Keep a persistent profile and reuse cf_clearance with the same IP and user agent; see how the cf_clearance cookie is bound.
  • Compare with Puppeteer stealth, Playwright stealth and patchright.

When to switch to an API

If bot-detector is clean, the environment is fixed and a site still loops, you are debugging Cloudflare's scoring, not the patches. The README suggests Rebrowser's paid cloud browsers here. The other route is to solve outside the browser: for a Turnstile widget, get a token from the Cloudflare Turnstile solver API (about 250 ms on average, $0.80 per 1,000) and write it into cf-turnstile-response; for the full-page challenge, the Cloudflare Challenge solver API returns cf_clearance plus the user_agent to replay through your proxy (about 3.3 s, $1.00 per 1,000).

NSLSolver solves server-side, with no browser on your side or ours. Only successful solves are billed (a 503 is free and safe to retry), and sign-ups with Google, Gmail or Proton get free trial credit; see pricing. It does not solve hCaptcha, reCAPTCHA v2, image CAPTCHAs, FunCaptcha, GeeTest or DataDome. For the wider field, see our comparison of open-source Turnstile and Cloudflare solvers. Only automate sites you own or are authorised to access.

Example: Turnstile token inside a rebrowser-puppeteer page

Keep the browser for navigation and clicks, and solve only the widget: read the sitekey (plus action and cdata if set), solve, and write the token into the hidden input, or pass it to the site's JavaScript callback if it uses one. Rejected tokens are covered in cf-turnstile-response invalid.

turnstile.mjs
// turnstile.mjs (Node 22.12+, npm i puppeteer@npm:rebrowser-puppeteer)
import puppeteer from 'puppeteer';

const API_KEY = process.env.NSLSOLVER_API_KEY;
const PAGE_URL = 'https://your-site.example.com/login';

const browser = await puppeteer.launch({ headless: false, defaultViewport: null });
const page = await browser.newPage();
await page.goto(PAGE_URL, { waitUntil: 'domcontentloaded' });

// 1) Read the widget settings (action / cdata only if the widget sets them)
const widget = await page.$eval('.cf-turnstile, [data-sitekey]', (el) => ({
  siteKey: el.getAttribute('data-sitekey'),
  action: el.getAttribute('data-action'),
  cdata: el.getAttribute('data-cdata'),
}));
const body = { type: 'turnstile', site_key: widget.siteKey, url: PAGE_URL };
if (widget.action) body.action = widget.action;
if (widget.cdata) body.cdata = widget.cdata;

// 2) Solve outside the browser (synchronous: the token is in the response)
const res = await fetch('https://api.nslsolver.com/solve', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'X-API-Key': API_KEY },
  body: JSON.stringify(body),
});
const data = await res.json();
if (!res.ok || !data.success) throw new Error(res.status + ' ' + JSON.stringify(data));

// 3) Put the token where the form expects it, then submit as usual
await page.$eval('input[name="cf-turnstile-response"]', (el, token) => { el.value = token; }, data.token);
await page.click('button[type="submit"]');

Example: cf_clearance without a browser

For the "Just a moment..." interstitial, send the url, the challenge site_key and your proxy, all required. Leave user_agent out, because the clearance is issued for the solver's iPhone Safari browser, then replay the cookies with the returned user_agent through the same proxy.

cf_clearance.py
import os

import requests

API_KEY = os.environ["NSLSOLVER_API_KEY"]
TARGET = "https://your-site.example.com/"
PROXY = "http://user:pass@sticky-proxy.example.com:8080"  # same exit IP for solve AND replay

resp = requests.post(
    "https://api.nslsolver.com/solve",
    headers={"X-API-Key": API_KEY},
    json={
        "type": "challenge",
        "url": TARGET,
        "site_key": "0x4AAAAAAA...",  # the challenge widget id (0x...)
        "proxy": PROXY,               # required for challenge
        # no user_agent: the clearance is issued for the solver's iPhone Safari browser
    },
    timeout=120,
)
if resp.status_code == 503:
    raise SystemExit("not completed (not billed), safe to retry")
data = resp.json()
if not data.get("success"):
    raise SystemExit(f"{resp.status_code} {data}")

# Replay cf_clearance with the returned user_agent through the SAME proxy
session = requests.Session()
session.proxies = {"http": PROXY, "https": PROXY}
session.headers["User-Agent"] = data["user_agent"]
session.cookies.update(data["cookies"])  # includes cf_clearance

page = session.get(TARGET, timeout=30)
print(page.status_code, len(page.text))

Full /solve API reference

Related guides

Frequently asked questions

Does rebrowser-patches bypass Cloudflare?

Not on its own. It removes library leaks such as Runtime.enable, which Cloudflare checks, but its README says the patches do not touch fingerprints, IP reputation or behaviour, and that Turnstile scores all of them. Fix those as well, or get the token or cf_clearance from a solver API.

Is rebrowser-patches still maintained in 2026?

Yes. After a gap from May 2025 to October 2026, four releases shipped, from 1.1.0 (17 October) to 1.1.3 (2 November 2026), which supports Puppeteer 25.16.0 and Playwright 1.64.1. No issues were open on 2026-12-01.

Why does rebrowser-playwright still fail the Runtime.enable test?

Usually the unpatched core is loaded. Before 1.1.1, the npm alias next to the original playwright of the same version silently resolved to stock playwright-core (issue #74), and a CLI patch is undone by npm install. Upgrade to 1.64.102 and check npm ls rebrowser-playwright-core.

Which REBROWSER_PATCHES_RUNTIME_FIX_MODE should I use?

Keep the default, addBinding. Use alwaysIsolated if page scripts must not observe your code and you do not need main-world variables or exposeFunction. Avoid enableDisable unless addBinding fails on one page, and use 0 only for debugging, for example page.pause().

Can I use rebrowser-puppeteer with puppeteer-extra?

Yes: wrap rebrowser-puppeteer-core with addExtra from puppeteer-extra. The README warns that adding the stealth plugin turns the nativeTampering and workerConsistency checks red, so test without it first.

rebrowser-playwright or patchright?

Both remove Playwright's Runtime.enable leak. rebrowser also covers Puppeteer and documents switchable fix modes; patchright patches Chromium only. Test both on your target in the same environment.

Keep your browser, outsource the Cloudflare step

Get a Turnstile token, or cf_clearance with the matching user_agent, from one POST. No browser on our side. Free credit with Google, Gmail or Proton sign-up, only successful solves billed.