grafana/k6 · error

%q: %w

Error message

%q: %w

What it means

In navigateFrame, the Page.navigate CDP call returned an error. When Chromium supplied no errorText, the raw CDP error is wrapped with the frame context; when errorText is present it is used instead. This is the error seen when page.goto fails at the navigation level.

Solutions

  1. Check the URL is well-formed and reachable from the browser
  2. Increase navigation timeouts and inspect net errors (DNS, TLS, refused connections)
  3. Handle navigation errors in the script with try/catch around page.goto if they are expected
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at internal/js/modules/k6/browser/common/frame_session.go:644 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of grafana/k6@3fcf5388d7 (2026-08-18). Data as JSON: /api/errors/0a3d34d7b4ef9389. Report an issue: GitHub.

Appendix: source

Thrown at internal/js/modules/k6/browser/common/frame_session.go:697

		return
	}
	for _, child := range frameTree.ChildFrames {
		fs.handleFrameTree(child, initialFrame)
	}
}

func (fs *FrameSession) navigateFrame(frame *Frame, url, referrer string) (string, error) {
	fs.logger.Debugf("FrameSession:navigateFrame",
		"sid:%v fid:%s tid:%v url:%q referrer:%q",
		fs.session.ID(), frame.ID(), fs.targetID, url, referrer)

	action := cdppage.Navigate(url).WithReferrer(referrer).WithFrameID(cdp.FrameID(frame.ID()))
	_, documentID, errorText, _, err := action.Do(cdp.WithExecutor(fs.ctx, fs.session))
	if err != nil {
		if errorText == "" {
			err = fmt.Errorf("%w", err)
		} else {
			err = fmt.Errorf("%q: %w", errorText, err)
		}
	}
	return documentID.String(), err
}

func (fs *FrameSession) onConsoleAPICalled(event *cdpruntime.EventConsoleAPICalled) {
	l := fs.logger.
		WithTime(event.Timestamp.Time()).
		WithField("source", "browser").
		WithField("browser_source", "console-api")

	/* accessing the state Group while not on the eventloop is racy
	if s := fs.vu.State(); s.Group.Path != "" {
		l = l.WithField("group", s.Group.Path)
	}
	*/

	parsedObjects := make([]string, 0, len(event.Args))

View on GitHub (pinned to 3fcf5388d7)