grafana/k6 · info
parsing focus options: %w
Error message
parsing focus options: %w
What it means
Options passed to frame.focus(selector, opts) failed to parse (frame_mapping.go:107). FrameBaseOptions.Parse reads only 'strict' and 'timeout' and always returns nil in this codebase - this wrapper is defensive and effectively unreachable in the current version.
Source
Thrown at internal/js/modules/k6/browser/browser/frame_mapping.go:107
if err != nil {
return nil, err //nolint:wrapcheck
}
return mapJSHandle(vu, jsh), nil
}), nil
},
"fill": func(selector, value string, opts sobek.Value) (*sobek.Promise, error) {
popts := common.NewFrameFillOptions(f.Timeout())
if err := popts.Parse(vu.Context(), opts); err != nil {
return nil, fmt.Errorf("parsing fill options: %w", err)
}
return promise(vu, func() (any, error) {
return nil, f.Fill(selector, value, popts) //nolint:wrapcheck
}), nil
},
"focus": func(selector string, opts sobek.Value) (*sobek.Promise, error) {
popts := common.NewFrameBaseOptions(f.Timeout())
if err := popts.Parse(vu.Context(), opts); err != nil {
return nil, fmt.Errorf("parsing focus options: %w", err)
}
return promise(vu, func() (any, error) {
return nil, f.Focus(selector, popts) //nolint:wrapcheck
}), nil
},
"frameElement": func() *sobek.Promise {
return promise(vu, func() (any, error) {
fe, err := f.FrameElement()
if err != nil {
return nil, err //nolint:wrapcheck
}
return mapElementHandle(vu, fe), nil
})
},
"getAttribute": func(selector, name string, opts sobek.Value) (*sobek.Promise, error) {
popts := common.NewFrameBaseOptions(f.Timeout())
if err := popts.Parse(vu.Context(), opts); err != nil {
return nil, fmt.Errorf("parsing getAttribute options: %w", err)View on GitHub (pinned to 93accf6570)
Solutions
- Use supported keys only: { timeout: 3000, strict: true }
- If it fires on stock k6, report it with the script and k6 version
Defensive patterns
Strategy: try-catch
Validate before calling
const safeOpts = { timeout: Number(opts?.timeout) || undefined, strict: !!opts?.strict }; Try / catch
try {
await frame.focus(sel, safeOpts);
} catch (e) {
console.error(`focus(${sel}) failed: ${e.message}`);
} Prevention
- Use only timeout/strict for focus
- Treat this specific message as a k6 defect signal, not a script bug
When it happens
Trigger: No focus option value can trigger it today; both keys are coerced without erroring. Only an internal k6 change to the parser could make it fire.
Common situations: Essentially never hit on stock k6; relevant only when triaging k6 forks or unreleased parser changes.
Related errors
- parsing new frame check options: %w
- parsing double click options: %w
- parsing frame dispatch event options: %w
- parsing fill options: %w
- parsing getAttribute options: %w
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/4dc3f6fa47c10343.
Report an issue: GitHub.