{"record":{"id":"89d9b0c154777e69","repo":"grafana/k6","slug":"missing-required-url","errorCode":null,"errorMessage":"missing required url","messagePattern":"missing required url","errorType":"exception","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/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/js/modules/k6/browser/browser/file_persister.go#L78-L101","documentation":"When K6_BROWSER_SCREENSHOTS_OUTPUT is set, the k6 browser module parses it as a comma-separated presigned-URL config `url=...,basePath=...,header.NAME=...` (parsePresignedURLEnvVar, internal/js/modules/k6/browser/browser/file_persister.go:41-100). The `url` entry is the only required one; if the variable is non-empty but contains no `url=` key, parsing fails with 'missing required url', surfaced as `parsing K6_BROWSER_SCREENSHOTS_OUTPUT: missing required url` when the browser module builds its screenshot persister.","triggerScenarios":"Setting the env var with only optional keys, e.g. `K6_BROWSER_SCREENSHOTS_OUTPUT=\"basePath=/shots\"` or `K6_BROWSER_SCREENSHOTS_OUTPUT=\"header.Authorization=Bearer x\"`, or using `;`/space instead of `,` as separator so no `url=` token is recognized. A key with wrong case (`URL=`) hits 'invalid option' instead, so this error specifically means: variable set, no parseable `url=` entry at all.","commonSituations":"Migrating screenshots from local disk to remote storage in CI and forgetting the URL; env files where the value got truncated at an `=` or newline; assuming basePath alone is enough; copy-pasting an env var between CI systems that mangle commas.","solutions":["Set the full value: `K6_BROWSER_SCREENSHOTS_OUTPUT=\"url=https://uploads.example.com/,basePath=/screenshots,header.Authorization=Bearer <token>\"`","If you want screenshots saved to the local disk instead, unset K6_BROWSER_SCREENSHOTS_OUTPUT entirely (empty/missing falls back to LocalFilePersister)","Verify the format with a quick parse before the run: each comma-separated token must be exactly `key=value` with keys url, basePath, or header.NAME"],"exampleFix":"# before\nexport K6_BROWSER_SCREENSHOTS_OUTPUT=\"basePath=/screenshots\"\n\n# after\nexport K6_BROWSER_SCREENSHOTS_OUTPUT=\"url=https://uploads.example.com/,basePath=/screenshots\"","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\n# validate before launching k6\nv=\"$K6_BROWSER_SCREENSHOTS_OUTPUT\"\nif [ -n \"$v\" ]; then\n  case \"$v\" in\n    url=*) ;;\n    *,url=*) ;;\n    *) echo \"K6_BROWSER_SCREENSHOTS_OUTPUT must start with (or contain) url=<scheme>://<host>\" >&2; exit 1;;\n  esac\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Memorize the exact format: url=https://host/,basePath=/dir,header.Name=value — comma-separated, keys case-sensitive","Unset the variable entirely when you want local-disk screenshots; a stray empty-ish value still disables the default behavior differently","Keep the value on a single line with no spaces around commas or equals signs","Document the env var in the repo's CI template so operators copy a known-good string"],"tags":["k6","browser","screenshots","environment-variables","configuration","remote-upload"],"backgroundTag":"misconfigured-env-var","analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":"2026-08-18T03:05:52.393Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}