(Created on )

Puppeteer: Memoized method was called with the wrong number of arguments

A memoized internal method is called with an argument count inconsistent with its cache.


A memoized internal method is called with an argument count inconsistent with its cache.

Error message

Memoized method was called with the wrong number of arguments

How this error happens

A memoized method records how many arguments its calls use. Calling the same method later with a different count violates that cache shape.

The snippets use a WebDriver BiDi page named page.

const response = await page.goto(
    "https://example.com"
);

response.remoteAddress();

response.remoteAddress(
    "unused"
);

How to fix

Call the public method with its documented argument count. remoteAddress takes no arguments.

const response = await page.goto(
    "https://example.com"
);

const address = response.remoteAddress();

console.log(address);

Things to keep in mind

This example uses a WebDriver BiDi response whose remoteAddress method is memoized. TypeScript should reject the extra argument. If a private emulation method fails instead, isolate any wrapper that changes its arguments.

All Puppeteer errors

Keep Reading

Puppeteer Guides

All Guides →