grafana/k6 · error

navigating to

Error message

navigating to %q: %w

What it means

Returned by FrameManager.NavigateFrame when the CDP Page.navigate call via the frame's session fails. The wrap names the target URL; the wrapped CDP error carries the cause: invalid URL, network failure, crashed target, or navigation cancelled by a subsequent navigation.

Solutions

  1. Verify the URL is valid and reachable
  2. Increase navigation timeout
  3. Check for concurrent navigations overriding this one
  4. Ensure the browser session is alive
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/frame_manager.go:695 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/5c618862245bc9e2. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/common/frame_manager.go:695

	defer lifecycleEvtCancel()

	fs, ok := frame.page.getFrameSession(cdp.FrameID(frame.ID()))
	if !ok {
		m.logger.Debugf("FrameManager:NavigateFrame",
			"fmid:%d fid:%v furl:%s url:%s fs:nil",
			fmid, fid, furl, url)

		// Attaching an iframe to an existing page doesn't seem to trigger a "Target.attachedToTarget" event
		// from the browser even when "Target.setAutoAttach" is true. If this is the case fallback to the

		// main frame's session.
		fs = frame.page.mainFrameSession
	}

	var err error
	newDocumentID, err = fs.navigateFrame(frame, url, parsedOpts.Referer)
	if err != nil {
		return nil, fmt.Errorf("navigating to %q: %w", url, err)
	}

	if newDocumentID == "" {
		// It's a navigation within the same document (e.g., via anchor links or
		// the History API), so don't wait for a response nor any lifecycle
		// events.
		return nil, nil //nolint:nilnil
	}

	// unblock the waiter goroutine
	close(newDocIDIsReadyCh)

	wrapTimeoutError := func(err error) error {
		if errors.Is(err, context.DeadlineExceeded) {
			err = &k6ext.UserFriendlyError{
				Err:     err,
				Timeout: parsedOpts.Timeout,
			}

View on GitHub (pinned to 01ffac6f24)