grafana/k6 · error
invalid accuracy "%.2f": precondition 0 <= ACCURACY failed
Error message
invalid accuracy "%.2f": precondition 0 <= ACCURACY failed
What it means
Geolocation.Validate rejected the geolocation options: accuracy is negative. CDP requires accuracy >= 0 (meters); the offending value is echoed and the error surfaces from newContext().
Solutions
- Use a non-negative accuracy, e.g. accuracy: 100
- Omit accuracy to use the browser default
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/browser_context_options.go:82 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/3482f5df6938da10.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/browser_context_options.go:82
if p == nil {
return nil
}
if strings.TrimSpace(p.Server) == "" {
return fmt.Errorf("proxy.server must be set")
}
return nil
}
// Validate validates the [Geolocation].
func (g *Geolocation) Validate() error {
if g.Longitude < -180 || g.Longitude > 180 {
return fmt.Errorf(`invalid longitude "%.2f": precondition -180 <= LONGITUDE <= 180 failed`, g.Longitude)
}
if g.Latitude < -90 || g.Latitude > 90 {
return fmt.Errorf(`invalid latitude "%.2f": precondition -90 <= LATITUDE <= 90 failed`, g.Latitude)
}
if g.Accuracy < 0 {
return fmt.Errorf(`invalid accuracy "%.2f": precondition 0 <= ACCURACY failed`, g.Accuracy)
}
return nil
}
// GrantPermissionsOptions is used by BrowserContext.GrantPermissions.
type GrantPermissionsOptions struct {
Origin string
}
View on GitHub (pinned to 01ffac6f24)