Puppeteer: Invalid accuracy '{value}': precondition 0 <= ACCURACY failed.
Geolocation accuracy is negative.
Geolocation accuracy is negative.
Error message
Invalid accuracy '{value}': precondition 0 <= ACCURACY failed.
{value} is replaced by the value shown in your error message.
How this error happens
accuracy must be zero or a positive number of meters. Invalid coordinates are rejected instead of being normalized.
The snippets use an open Puppeteer page named page.
await page.setGeolocation({
latitude: 48.8566,
longitude: 2.3522,
accuracy: -1,
});
How to fix
Validate the input and pass a value within the accepted range.
await page.setGeolocation({
latitude: 48.8566,
longitude: 2.3522,
accuracy: 10,
});
Things to keep in mind
A valid location override does not grant geolocation permission. Grant that permission separately for the origin being tested.