{"record":{"id":"c20a506e4b9a8806","repo":"grafana/k6","slug":"invalid-option-q","errorCode":null,"errorMessage":"invalid option %q","messagePattern":"invalid option %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/browser/file_persister.go","lineNumber":91,"sourceCode":"\n\t\t\tif hk == \"\" {\n\t\t\t\treturn presignedURLConfig{}, fmt.Errorf(\"empty header key, received %q\", s)\n\t\t\t}\n\t\t}\n\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":73,"sourceCodeEnd":101,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/browser/file_persister.go#L73-L101","documentation":"An unknown key was found in K6_BROWSER_SCREENSHOTS_OUTPUT (file_persister.go:91). Only 'url', 'basePath', and 'header.<name>' are recognized; keys are case-sensitive, and anything else falls into the default branch.","triggerScenarios":"K6_BROWSER_SCREENSHOTS_OUTPUT contains 'URL=https://h/' (uppercase), 'path=/shots', 'output=remote', 'type=s3', or 'headers.1=x' - note 'headers.1' does not contain the substring 'header.', so it hits the default branch instead of being treated as a header.","commonSituations":"Guessing option names from similar tools; renaming from an older/other convention ('path' vs 'basePath'); typo 'headers.' plural; documentation drift between k6 versions.","solutions":["Use exactly the three supported keys: url, basePath, header.<Name>","Fix plural/case mistakes: 'headers.1=' -> 'header.1=', 'URL=' -> 'url=', 'path=' -> 'basePath='","Remove options the parser does not support (there is no timeout/type/output option here)"],"exampleFix":"# before\nK6_BROWSER_SCREENSHOTS_OUTPUT=\"url=https://h/,path=/shots,headers.1=a\"\n# after\nK6_BROWSER_SCREENSHOTS_OUTPUT=\"url=https://h/,basePath=/shots,header.1=a\"","handlingStrategy":"validation","validationCode":"const allowed = /^(url|basePath|header[.][^.]+)$/;\nconst bad = v.split(',').map(s => s.split('=')[0]).filter(k => !allowed.test(k));\nif (bad.length) throw new Error(`unknown keys (allowed: url, basePath, header.Name): ${bad.join(', ')}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use lowercase singular keys only: url, basePath, header.<Name>","Remember 'headers.' (plural) and 'URL=' are rejected","Keep an allowlist regex in CI"],"tags":["k6","browser","environment-variable","parsing","screenshots"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}