grafana/k6 · error
invalid option %q
Error message
invalid option %q
What it means
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.
Source
Thrown at internal/js/modules/k6/browser/browser/file_persister.go:91
if hk == "" {
return presignedURLConfig{}, fmt.Errorf("empty header key, received %q", s)
}
}
switch k {
case "url":
u, err := url.ParseRequestURI(v)
if err != nil && u.Scheme != "" && u.Host != "" {
return presignedURLConfig{}, fmt.Errorf("invalid url %q", s)
}
presignedURL.getterURL = v
case "basePath":
presignedURL.basePath = v
case "header":
presignedURL.headers[hk] = hv
default:
return presignedURLConfig{}, fmt.Errorf("invalid option %q", k)
}
}
if presignedURL.getterURL == "" {
return presignedURLConfig{}, errors.New("missing required url")
}
return presignedURL, nil
}
View on GitHub (pinned to 93accf6570)
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)
Example fix
# before K6_BROWSER_SCREENSHOTS_OUTPUT="url=https://h/,path=/shots,headers.1=a" # after K6_BROWSER_SCREENSHOTS_OUTPUT="url=https://h/,basePath=/shots,header.1=a"
Defensive patterns
Strategy: validation
Validate before calling
const allowed = /^(url|basePath|header[.][^.]+)$/;
const bad = v.split(',').map(s => s.split('=')[0]).filter(k => !allowed.test(k));
if (bad.length) throw new Error(`unknown keys (allowed: url, basePath, header.Name): ${bad.join(', ')}`); Prevention
- Use lowercase singular keys only: url, basePath, header.<Name>
- Remember 'headers.' (plural) and 'URL=' are rejected
- Keep an allowlist regex in CI
When it happens
Trigger: 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.
Common situations: Guessing option names from similar tools; renaming from an older/other convention ('path' vs 'basePath'); typo 'headers.' plural; documentation drift between k6 versions.
Related errors
- format of value must be k=v, received %q
- parsing %s: %w
- format of header must be header.k=v, received %q
- empty header key, received %q
- invalid url %q
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/c20a506e4b9a8806.
Report an issue: GitHub.