grafana/k6 · error
invalid timeout value: %w
Error message
invalid timeout value: %w
What it means
Also in parseRequest's params loop: the timeout value given in the request params could not be converted/validated as a valid duration, so the request setup fails. The user supplied a timeout of the wrong type or format in the params argument to an http method.
Source
Thrown at js/modules/k6/http/request.go:402
algo = strings.TrimSpace(algo)
result.Compressions[index], err = httpext.CompressionTypeString(algo)
if err != nil {
return nil, fmt.Errorf("unknown compression algorithm %s, supported algorithms are %s",
algo, httpext.CompressionTypeValues())
}
}
case "redirects":
result.Redirects = null.IntFrom(params.Get(k).ToInteger())
case "tags":
if err := common.ApplyCustomUserTags(rt, &result.TagsAndMeta, params.Get(k)); err != nil {
return nil, fmt.Errorf("invalid HTTP request metric tags: %w", err)
}
case "auth":
result.Auth = params.Get(k).String()
case "timeout":
t, err := types.GetDurationValue(params.Get(k).Export())
if err != nil {
return nil, fmt.Errorf("invalid timeout value: %w", err)
}
result.Timeout = t
case "throw":
result.Throw = params.Get(k).ToBoolean()
case "responseType":
responseType, err := httpext.ResponseTypeString(params.Get(k).String())
if err != nil {
return nil, err
}
result.ResponseType = responseType
case "responseCallback":
v := params.Get(k).Export()
if v == nil {
result.ResponseCallback = nil
} else if c, ok := v.(*expectedStatuses); ok {
result.ResponseCallback = c.match
} else {
return nil, fmt.Errorf("unsupported responseCallback")View on GitHub (pinned to 01ffac6f24)
Solutions
- Use a valid Go duration string, e.g. timeout: '30s' or '2m'
- Check for missing unit suffixes (bare numbers are invalid)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at js/modules/k6/http/request.go:402 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
AI-assisted analysis of grafana/k6@01ffac6f24 (2026-08-18).
Data as JSON: /api/errors/48f5d19084b73909.
Report an issue: GitHub.