Puppeteer: Cannot extract value when no objectId is given
An internal remote-object operation requires an objectId but received none.
An internal remote-object operation requires an objectId but received none.
Error message
Cannot extract value when no objectId is given
How this error happens
An internal reference-only operation needs a CDP objectId. A primitive handle has a by-value representation and no object ID.
The snippets use an open Chrome/CDP page named page.
const handle = await page.evaluateHandle(() => {
return 42;
});
const remote = handle.remoteObject();
console.log(remote.objectId);
How to fix
Read primitives by value through the public API instead of routing them to a reference-only decoder.
const value = await page.evaluate(() => {
return 42;
});
console.log(value);
Things to keep in mind
Dispose the original handle after use. The first snippet exposes the missing-ID condition; it does not itself call the internal decoder or guarantee this error.