{"record":{"id":"89d9b0c154777e69","repo":"grafana/k6","slug":"missing-required-url","errorCode":null,"errorMessage":"missing required url","messagePattern":"missing required url","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/file_persister.go","lineNumber":96,"sourceCode":"\n\t\tswitch k {\n\t\tcase \"url\":\n\t\t\tu, err := url.ParseRequestURI(v)\n\t\t\tif err != nil && u.Scheme != \"\" && u.Host != \"\" {\n\t\t\t\treturn presignedURLConfig{}, fmt.Errorf(\"invalid url %q\", s)\n\t\t\t}\n\t\t\tpresignedURL.getterURL = v\n\t\tcase \"basePath\":\n\t\t\tpresignedURL.basePath = v\n\t\tcase \"header\":\n\t\t\tpresignedURL.headers[hk] = hv\n\t\tdefault:\n\t\t\treturn presignedURLConfig{}, fmt.Errorf(\"invalid option %q\", k)\n\t\t}\n\t}\n\n\tif presignedURL.getterURL == \"\" {\n\t\treturn presignedURLConfig{}, errors.New(\"missing required url\")\n\t}\n\n\treturn presignedURL, nil\n}\n","sourceCodeStart":78,"sourceCodeEnd":101,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/browser/file_persister.go#L78-L101","documentation":"The k6 browser module decides how to persist screenshots by parsing the K6_BROWSER_SCREENSHOTS_OUTPUT environment variable. When that variable is set but none of its comma-separated k=v pairs uses the key 'url', parsePresignedURLEnvVar returns this error, which newScreenshotPersister wraps as 'parsing K6_BROWSER_SCREENSHOTS_OUTPUT: missing required url'. The url key is the only mandatory entry because it is the remote endpoint screenshots are uploaded to; basePath and header.N entries are optional. Browser module initialization fails fast, aborting the test run before any script executes.","triggerScenarios":"Setting K6_BROWSER_SCREENSHOTS_OUTPUT to a value containing only optional keys, e.g. 'basePath=/screenshots' or 'header.Authorization=token', or misspelling the key as 'uri=' or 'URL=' (keys are case-sensitive and matched exactly by the switch in parsePresignedURLEnvVar).","commonSituations":"Copying a remote-upload example config incompletely in CI pipelines, renaming or translating keys when moving between environments, or adding custom headers/basePath while forgetting the endpoint. Also appears when the variable is set to a placeholder value during environment provisioning.","solutions":["Add the required url key as a k=v pair, e.g. K6_BROWSER_SCREENSHOTS_OUTPUT=\"url=https://127.0.0.1:9000/,basePath=/screenshots\"","Verify every pair is strictly key=value with no extra spaces or quotes inside the value; the parser rejects pairs without exactly one '='","If local disk persistence is intended, unset K6_BROWSER_SCREENSHOTS_OUTPUT entirely so newScreenshotPersister returns LocalFilePersister","Double-check key spelling and case: only url, basePath, and header.<name> are accepted; anything else yields 'invalid option'"],"exampleFix":"# before\nexport K6_BROWSER_SCREENSHOTS_OUTPUT=\"basePath=/screenshots,header.Authorization=Bearer t\"\n\n# after\nexport K6_BROWSER_SCREENSHOTS_OUTPUT=\"url=https://screenshots.example.com/,basePath=/screenshots,header.Authorization=Bearer t\"","handlingStrategy":"validation","validationCode":"# Run before k6: fail early with a clear message\nvalue=\"${K6_BROWSER_SCREENSHOTS_OUTPUT:-}\"\nif [ -n \"$value\" ] && ! printf '%s' \"$value\" | grep -qE '(^|,)url='; then\n  echo \"K6_BROWSER_SCREENSHOTS_OUTPUT must contain a url=... entry\" >&2\n  exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat the env var format as url=<endpoint> first, then optional basePath= and header.<name>= pairs","Keep screenshot-upload config in one place (CI template or .env) instead of ad-hoc exports","Add a pipeline step that validates the variable matches key=value comma syntax before launching k6","Leave the variable unset when local-disk screenshots are acceptable"],"tags":["browser","configuration","environment-variables","screenshots","startup"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}