{"record":{"id":"3a902cd02c139ddd","repo":"grafana/k6","slug":"missing-required-argument-url","errorCode":null,"errorMessage":"missing required argument 'url'","messagePattern":"missing required argument 'url'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/page_mapping.go","lineNumber":969,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"page.route('%s'): %w\", path, err)\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\treturn promise(vu, func() (any, error) {\n\t\t\treturn nil, p.Route(ppath, route, newRegExMatcher(ctx, vu, tq))\n\t\t}), nil\n\t}\n}\n\nfunc mapWaitForURL(vu moduleVU, target interface {\n\tTimeout() time.Duration\n\tWaitForURL(urlPattern string, opts *common.FrameWaitForURLOptions, rm common.RegExMatcher) error\n}, url sobek.Value, opts sobek.Value,\n) (*sobek.Promise, error) {\n\tif k6common.IsNullish(url) {\n\t\treturn nil, errors.New(\"missing required argument 'url'\")\n\t}\n\tpopts := common.NewFrameWaitForURLOptions(target.Timeout())\n\tif err := popts.Parse(vu.Context(), opts); err != nil {\n\t\treturn nil, fmt.Errorf(\"parsing waitForURL options: %w\", err)\n\t}\n\n\tpurl := parseStringOrRegex(url, false)\n\ttq, ctx, stop := newTaskQueue(vu)\n\n\treturn promise(vu, func() (result any, reason error) {\n\t\tdefer stop()\n\t\treturn nil, target.WaitForURL(purl, popts, newRegExMatcher(ctx, vu, tq))\n\t}), nil\n}\n\nfunc mapWaitForNavigation(vu moduleVU, target interface {\n\tTimeout() time.Duration\n\tWaitForNavigation(*common.FrameWaitForNavigationOptions, common.RegExMatcher) (*common.Response, error)","sourceCodeStart":951,"sourceCodeEnd":987,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/browser/page_mapping.go#L951-L987","documentation":"Both page.waitForURL and frame.waitForURL route through mapWaitForURL, which requires a URL pattern as the first argument. It is validated with k6common.IsNullish before options are parsed and before parseStringOrRegex converts it to a glob-string or RegExp matcher. Calling waitForURL with no pattern fails fast with this error.","triggerScenarios":"await page.waitForURL() with no arguments; await frame.waitForURL(null); passing only options: await page.waitForURL({ waitUntil: 'load' }); an empty string is NOT nullish and instead matches per glob semantics (tests use it explicitly).","commonSituations":"Porting Playwright's waitForURL and forgetting the URL; building the pattern from a variable that is undefined; assuming options can carry the URL.","solutions":["Pass a glob string or RegExp: await page.waitForURL('**/dashboard') or await page.waitForURL(/.*dashboard$/)","Pass options as the second argument only: await page.waitForURL('**/dashboard', { waitUntil: 'load', timeout: 5000 })","Guard dynamic patterns: if (!pattern) throw new Error('waitForURL requires a pattern')"],"exampleFix":"// before\nawait page.waitForURL({ waitUntil: 'load' });\n\n// after\nawait page.waitForURL('**/dashboard', { waitUntil: 'load' });","handlingStrategy":"validation","validationCode":"if (url === undefined || url === null) {\n  throw new Error('waitForURL: a glob string or RegExp pattern is required');\n}\nawait page.waitForURL(url, opts);","typeGuard":"function isURLPattern(v) {\n  return typeof v === 'string' || v instanceof RegExp;\n}","tryCatchPattern":"try {\n  await page.waitForURL(pattern);\n} catch (e) {\n  if (e.message.includes(\"missing required argument 'url'\")) {\n    throw new Error('waitForURL called without a URL pattern');\n  }\n  throw e; // timeout or navigation errors bubble up\n}","preventionTips":["Pass the pattern first and options second; the signature is waitForURL(pattern, opts)","Empty string is a valid (nullish-free) pattern — pass an explicit RegExp or glob instead of '' when you mean 'any URL'"],"tags":["browser","page","frame","waitforurl","navigation","argument-validation"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}