grafana/k6 · error
timeout must be greater than 0
Error message
timeout must be greater than 0
What it means
validateConfig() requires the url secret source's HTTP client timeout to be strictly positive. A zero or negative duration (including ones produced by '0s' or '-5s') fails startup immediately. Since newConfig() supplies a sane default, this error only appears when the timeout is explicitly overridden to a non-positive value.
Source
Thrown at internal/secretsource/url/url.go:583
config = config.Apply(explicitCfg)
}
// Validate the final config
if err := validateConfig(config); err != nil {
return extConfig{}, err
}
return config, nil
}
func validateConfig(config extConfig) error {
// Validate required fields and value constraints
if err := validateURLTemplate(config.URLTemplate); err != nil {
return err
}
if config.Timeout.Duration <= 0 {
return errors.New("timeout must be greater than 0")
}
if config.RequestsPerMinuteLimit.Int64 <= 0 {
return errors.New("requestsPerMinuteLimit must be greater than 0")
}
if config.RequestsBurst.Int64 <= 0 {
return errors.New("requestsBurst must be greater than 0")
}
if config.MaxRetries.Int64 < 0 {
return errors.New("maxRetries must be non-negative")
}
if config.RetryBackoff.Duration <= 0 {
return errors.New("retryBackoff must be greater than 0")
}
View on GitHub (pinned to 93accf6570)
Solutions
- Remove the timeout override so the built-in default applies
- Or set a positive value such as K6_SECRET_SOURCE_URL_TIMEOUT='30s'
- Scan the JSON config file and environment for 'timeout' entries set to 0 or negative durations
Example fix
# before K6_SECRET_SOURCE_URL_TIMEOUT='0s' # after K6_SECRET_SOURCE_URL_TIMEOUT='30s'
Defensive patterns
Strategy: validation
Validate before calling
const t = Number(process.env.K6_SECRET_SOURCE_URL_TIMEOUT?.replace(/s$/, ''));
if (process.env.K6_SECRET_SOURCE_URL_TIMEOUT && t <= 0) {
throw new Error('timeout must be > 0');
} Prevention
- Do not set timeout to 0 expecting 'no timeout'; omit it to use the default
- Validate numeric env overrides in a preflight script
- Keep zeroed config scaffolds out of production
When it happens
Trigger: Setting K6_SECRET_SOURCE_URL_TIMEOUT='0s' (or a negative duration), or a JSON/inline config with "timeout": "0s" / negative duration; the override survives the Apply() merge and fails validateConfig().
Common situations: Trying to disable the timeout by setting it to 0; unit tests that zero out all fields; a config file that enumerates every field with placeholder zeros.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- urlTemplate must contain {key} placeholder
- urlTemplate must be an absolute URL with a scheme (e.g., htt
- requestsPerMinuteLimit must be greater than 0
- requestsBurst must be greater than 0
- maxRetries must be non-negative
AI-assisted analysis of grafana/k6@93accf6570 (2026-08-15).
Data as JSON: /api/errors/63198f6c1a1de213.
Report an issue: GitHub.