{"record":{"id":"56e54032ca79f618","repo":"grafana/k6","slug":"parsing-frame-dispatch-event-options-w","errorCode":null,"errorMessage":"parsing frame dispatch event options: %w","messagePattern":"parsing frame dispatch event options: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"info","filePath":"internal/js/modules/k6/browser/browser/frame_mapping.go","lineNumber":64,"sourceCode":"\t\t},\n\t\t\"content\": func() *sobek.Promise {\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn f.Content() //nolint:wrapcheck\n\t\t\t})\n\t\t},\n\t\t\"dblclick\": func(selector string, opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tpopts := common.NewFrameDblClickOptions(f.Timeout())\n\t\t\tif err := popts.Parse(vu.Context(), opts); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing double click options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, f.Dblclick(selector, popts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"dispatchEvent\": func(selector, typ string, eventInit, opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tpopts := common.NewFrameDispatchEventOptions(f.Timeout())\n\t\t\tif err := popts.Parse(vu.Context(), opts); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing frame dispatch event options: %w\", err)\n\t\t\t}\n\t\t\tearg := exportArg(eventInit)\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, f.DispatchEvent(selector, typ, earg, popts) //nolint:wrapcheck\n\t\t\t}), nil\n\t\t},\n\t\t\"evaluate\": func(pageFunc sobek.Value, gargs ...sobek.Value) (*sobek.Promise, error) {\n\t\t\tif sobekEmptyString(pageFunc) {\n\t\t\t\treturn nil, fmt.Errorf(\"evaluate requires a page function\")\n\t\t\t}\n\t\t\tfuncString := pageFunc.String()\n\t\t\tgopts := exportArgs(gargs)\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn f.Evaluate(funcString, gopts...)\n\t\t\t}), nil\n\t\t},\n\t\t\"evaluateHandle\": func(pageFunc sobek.Value, gargs ...sobek.Value) (*sobek.Promise, error) {\n\t\t\tif sobekEmptyString(pageFunc) {","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/browser/frame_mapping.go#L46-L82","documentation":"Options passed to frame.dispatchEvent(selector, type, eventInit, opts) failed to parse (frame_mapping.go:64). FrameDispatchEventOptions embeds *FrameBaseOptions, whose Parse only reads 'strict' and 'timeout' and always returns nil in this codebase - so this branch is defensive and effectively unreachable in the current version; hitting it indicates an internal k6 regression or a modified option parser.","triggerScenarios":"No user input triggers it in this version: dispatchEvent options ({ timeout, strict }) never produce a parse error. It would only fire if a k6 upgrade made FrameBaseOptions.Parse type-sensitive.","commonSituations":"Almost never seen in practice; if reported, it usually accompanies a custom k6 fork or an unreleased change to the option parsers.","solutions":["Pass a plain options object with only supported keys: { timeout: 5000, strict: true }","Reproduce on the latest stable k6; if it still fires, open an issue with the script and k6 version","Pin/downgrade to a known-good k6 version while investigating"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const safeOpts = opts == null ? {} : { timeout: Number(opts.timeout) || undefined, strict: !!opts.strict };","typeGuard":null,"tryCatchPattern":"try {\n  await frame.dispatchEvent(sel, type, eventInit, safeOpts);\n} catch (e) {\n  console.error(`dispatchEvent(${type}) on ${sel} failed: ${e.message}`);\n}","preventionTips":["Pass a plain object with only timeout/strict","If this fires on stock k6, capture the exact options and k6 version for a bug report"],"tags":["k6","browser","frame","options-parsing","dispatchevent"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}