grafana/k6 · error
should be a time duration value
Error message
%s should be a time duration value: %w
What it means
parseTimeOpt failed types.GetDurationValue on a duration-typed K6_BROWSER_* env var (e.g. K6_BROWSER_TIMEOUT). Values like 'thirty' or '10' without a unit (depending on parser) are rejected; the key name is echoed with the wrapped parse error.
Solutions
- Use Go duration syntax: K6_BROWSER_TIMEOUT='30s', '1m30s', '500ms'
- Always include a time unit
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/common/browser_options.go:146 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/8aed59cb4f01b9bb.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/common/browser_options.go:146
}
_, ignore := shouldIgnoreIfBrowserIsRemote[opt]
return ignore
}
func parseBoolOpt(k, v string) (bool, error) {
b, err := strconv.ParseBool(v)
if err != nil {
return false, fmt.Errorf("%s should be a boolean", k)
}
return b, nil
}
func parseTimeOpt(k, v string) (time.Duration, error) {
t, err := types.GetDurationValue(v)
if err != nil {
return time.Duration(0), fmt.Errorf("%s should be a time duration value: %w", k, err)
}
return t, nil
}
func parseListOpt(v string) []string {
elems := strings.Split(v, ",")
// If last element is a void string,
// because value contained an ending comma,
// remove it
if elems[len(elems)-1] == "" {
elems = elems[:len(elems)-1]
}
return elems
}
View on GitHub (pinned to 01ffac6f24)