grafana/k6 · error
throttling CPU
Error message
throttling CPU: %w
What it means
Wrap of the CDP Emulation.setCPUThrottlingRate command: throttleCPU sends the configured CPUProfile.Rate to the browser to slow down the page's main thread. The wrapped error surfaces when the CDP command cannot be executed — the session or context was canceled (test iteration ending), the target is gone, or the rate is outside what the browser accepts (e.g., zero or negative).
Solutions
- Use a positive CPU throttling rate (e.g., 4 for 4x slowdown)
- Ensure the browser session is still alive and the page target exists when applying CPU throttling
- Apply throttling through context/page options before heavy navigation rather than mid-teardown
- Update to the latest k6 browser module and bundled Chromium
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/frame_session.go:1209 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/ce22377067330a7c.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/frame_session.go:1267
if !initial || offline {
if err := fs.networkManager.SetOfflineMode(offline); err != nil {
return fmt.Errorf("updating offline mode for frame %v: %w", fs.targetID, err)
}
}
return nil
}
func (fs *FrameSession) throttleNetwork(networkProfile NetworkProfile) error {
fs.logger.Debugf("NewFrameSession:throttleNetwork", "sid:%v tid:%v", fs.session.ID(), fs.targetID)
return fs.networkManager.ThrottleNetwork(networkProfile)
}
func (fs *FrameSession) throttleCPU(cpuProfile CPUProfile) error {
action := emulation.SetCPUThrottlingRate(cpuProfile.Rate)
if err := action.Do(cdp.WithExecutor(fs.ctx, fs.session)); err != nil {
return fmt.Errorf("throttling CPU: %w", err)
}
return nil
}
func (fs *FrameSession) updateRequestInterception(enable bool) error {
fs.logger.Debugf("NewFrameSession:updateRequestInterception",
"sid:%v tid:%v on:%v",
fs.session.ID(),
fs.targetID, enable)
return fs.networkManager.setRequestInterception(enable)
}
func (fs *FrameSession) updateViewport(ctx context.Context, emulatedSize *EmulatedSize) error {
fs.logger.Debugf("NewFrameSession:updateViewport", "sid:%v tid:%v", fs.session.ID(), fs.targetID)
// other frames don't have viewports and,View on GitHub (pinned to 3fcf5388d7)