grafana/k6 · error

invalid latitude "%.2f": precondition -90 <= LATITUDE <= 90…

Error message

invalid latitude "%.2f": precondition -90 <= LATITUDE <= 90 failed

What it means

Geolocation.Validate rejected the geolocation options: latitude is outside [-90, 90]. The offending value is echoed; this mirrors CDP's precondition and fires at newContext time, before any browser context exists.

Solutions

  1. Use a latitude in [-90, 90]
  2. Check sign conventions: negative latitude is south of the equator
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/browser_context_options.go:79 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/46244b7fda5d4047. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/common/browser_context_options.go:79

// Validate validates the [ProxyOptions].
func (p *ProxyOptions) Validate() error {
	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)