{"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":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/frame_mapping.go","lineNumber":205,"sourceCode":"\t\t\t}\n\t\t\tptext, popts := parseGetByBaseOptions(vu.Context(), text, true, opts)\n\n\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, err := parseFrameGotoOptions(rt, opts, f.Referrer(), f.NavigationTimeout())\n\t\t\tif 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, err := parseFrameHoverOptions(rt, opts, f.Timeout())\n\t\t\tif 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":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/grafana/k6/blob/8d06114777191d21ef885d05c5f8aa9e1ed838ae/internal/js/modules/k6/browser/browser/frame_mapping.go#L187-L223","documentation":"Thrown when `frame.goto(url, opts)` receives an invalid options value. The parseable keys are `referer` (string), `timeout` (ms), and `waitUntil` — an enum that must be exactly one of 'load', 'domcontentloaded', or 'networkidle' (validated by LifecycleEvent.UnmarshalText, which lists the valid values in the error). The URL is included in the message to identify the failing navigation.","triggerScenarios":"Calling `frame.goto('https://x/', { waitUntil: 'networkIdle' })` (camelCase typo), `{ waitUntil: 'domContentLoaded' }`, or any other string not in the enum. The underlying error reads: \"invalid lifecycle event: %q; must be one of: domcontentloaded, load, networkidle\".","commonSituations":"Porting Playwright scripts that assume case-insensitive or additional lifecycle names ('commit', 'interactive' in newer Playwright); typos like 'NetworkIdle' or 'network idle'; copy-pasting waitUntil values accepted by Puppeteer's Page.gotoOptions.","solutions":["Use exactly 'load', 'domcontentloaded', or 'networkidle' (all lowercase) for waitUntil","Read the wrapped cause — it enumerates every valid lifecycle event value","If you copied from Playwright docs, drop unsupported events like 'commit' or 'interactive'"],"exampleFix":"// before\nawait frame.goto('https://example.com/', { waitUntil: 'networkIdle' });\n\n// after\nawait frame.goto('https://example.com/', { waitUntil: 'networkidle' });","handlingStrategy":"validation","validationCode":"const WAIT_UNTIL = new Set(['load', 'domcontentloaded', 'networkidle']);\nfunction assertGotoOpts(opts = {}) {\n  if (opts.waitUntil !== undefined && !WAIT_UNTIL.has(opts.waitUntil)) {\n    throw new Error(`waitUntil must be one of: ${[...WAIT_UNTIL].join(', ')}`);\n  }\n}","typeGuard":"function isValidLifecycleEvent(v) {\n  return v === 'load' || v === 'domcontentloaded' || v === 'networkidle';\n}","tryCatchPattern":"try {\n  await frame.goto(url, opts);\n} catch (e) {\n  if (/parsing frame navigation options .*invalid lifecycle event/.test(String(e))) {\n    throw new Error(`Bad waitUntil in goto(${url}); use load|domcontentloaded|networkidle`);\n  }\n  throw e;\n}","preventionTips":["Define waitUntil values as constants, never inline strings","Remember the enum is lowercase — 'networkidle', not 'networkIdle'","Read the wrapped cause: it lists every valid value at runtime"],"tags":["k6","browser","frame","goto","navigation","wait-until","lifecycle-event","options"],"backgroundTag":"invalid-enum-value","analyzedSha":"8d06114777191d21ef885d05c5f8aa9e1ed838ae","analyzedAt":"2026-09-14T20:10:14.619Z","contentChangedAt":"2026-09-14T20:10:14.619Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}