{"record":{"id":"d257d033b7880ef2","repo":"grafana/k6","slug":"parsing-frame-navigation-options-to-q-w","errorCode":null,"errorMessage":"parsing frame navigation options to %q: %w","messagePattern":"parsing frame navigation options to %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/frame_mapping.go","lineNumber":207,"sourceCode":"\t\t\tml := mapLocator(vu, f.GetByText(ptext, popts))\n\t\t\treturn rt.ToValue(ml).ToObject(rt), nil\n\t\t},\n\t\t\"getByTitle\": func(title sobek.Value, opts sobek.Value) (*sobek.Object, error) {\n\t\t\tif k6common.IsNullish(title) {\n\t\t\t\treturn nil, errors.New(\"missing required argument 'title'\")\n\t\t\t}\n\t\t\tptitle, popts := parseGetByBaseOptions(vu.Context(), title, false, opts)\n\n\t\t\tml := mapLocator(vu, f.GetByTitle(ptitle, popts))\n\t\t\treturn rt.ToValue(ml).ToObject(rt), nil\n\t\t},\n\t\t\"goto\": func(url string, opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tgopts := common.NewFrameGotoOptions(\n\t\t\t\tf.Referrer(),\n\t\t\t\tf.NavigationTimeout(),\n\t\t\t)\n\t\t\tif err := gopts.Parse(vu.Context(), opts); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing frame navigation options to %q: %w\", url, err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\tresp, err := f.Goto(url, gopts)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err //nolint:wrapcheck\n\t\t\t\t}\n\n\t\t\t\treturn mapResponse(vu, resp), nil\n\t\t\t}), nil\n\t\t},\n\t\t\"hover\": func(selector string, opts sobek.Value) (*sobek.Promise, error) {\n\t\t\tpopts := common.NewFrameHoverOptions(f.Timeout())\n\t\t\tif err := popts.Parse(vu.Context(), opts); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"parsing hover options: %w\", err)\n\t\t\t}\n\t\t\treturn promise(vu, func() (any, error) {\n\t\t\t\treturn nil, f.Hover(selector, popts) //nolint:wrapcheck\n\t\t\t}), nil","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/browser/frame_mapping.go#L189-L225","documentation":"The options object passed to frame.goto(url, opts) failed to parse (frame_mapping.go:207). FrameGotoOptions.Parse accepts 'referer', 'timeout', and 'waitUntil'; only an invalid waitUntil fails - it must be exactly one of 'load', 'domcontentloaded', or 'networkidle' (lifecycle.go UnmarshalText rejects anything else). The error message includes the target URL to help locate the failing call.","triggerScenarios":"frame.goto('https://example.com', { waitUntil: 'networkIdle' }) (camelCase), 'loaded', 'domcontentloaded ' (trailing space), or any unsupported value - UnmarshalText returns 'invalid lifecycle event: %q; must be one of: ...' which this wrapper prepends with 'parsing frame navigation options to \"<url>\":'.","commonSituations":"Porting from Playwright/Puppeteer where casing differs or extra events exist; option objects shared across page.goto and waitForLoadState with a typo; constants defined with different capitalization ('NETWORKIDLE').","solutions":["Use one of the exact lowercase strings: 'load', 'domcontentloaded', 'networkidle'","Centralize the constant: const WAIT_UNTIL = Object.freeze({ LOAD: 'load', DOM: 'domcontentloaded', IDLE: 'networkidle' })","Validate before the call: if (!['load','domcontentloaded','networkidle'].includes(opts.waitUntil)) throw ..."],"exampleFix":"// before\nframe.goto('https://example.com', { waitUntil: 'networkIdle' });\n// after\nframe.goto('https://example.com', { waitUntil: 'networkidle' });","handlingStrategy":"validation","validationCode":"const WAIT_UNTIL = new Set(['load', 'domcontentloaded', 'networkidle']);\nif (opts?.waitUntil != null && !WAIT_UNTIL.has(opts.waitUntil)) {\n  throw new Error(`waitUntil must be one of: ${[...WAIT_UNTIL].join(', ')}; got ${opts.waitUntil}`);\n}","typeGuard":"function isWaitUntil(v) {\n  return v == null || ['load', 'domcontentloaded', 'networkidle'].includes(v);\n}","tryCatchPattern":"try {\n  const resp = await frame.goto(url, opts);\n} catch (e) {\n  if (String(e.message).includes('parsing frame navigation options')) {\n    throw new Error(`bad goto options for ${url}: check waitUntil spelling`);\n  }\n  throw e; // navigation timeout / network error\n}","preventionTips":["Use exact lowercase values: 'load', 'domcontentloaded', 'networkidle'","Define one frozen constants object for lifecycle events and import it everywhere","Do not copy waitUntil strings from Playwright docs blindly - casing differs"],"tags":["k6","browser","frame","goto","options-parsing"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}