grafana/k6 · error
batch request %v doesn't have a url key
Error message
batch request %v doesn't have a url key
What it means
An object-form entry in the batch requests (keyed by 'key' in the error) is missing its required 'url' property. parseBatchRequest looks up data["url"] in the map and refuses entries without it; method, body and params are all optional, only url is mandatory.
Source
Thrown at js/modules/k6/http/request.go:579
if dataLen < 2 {
return nil, fmt.Errorf("invalid batch request '%#v'", data)
}
method, ok = data[0].(string)
if !ok {
return nil, fmt.Errorf("invalid method type '%#v'", data[0])
}
reqURL = data[1]
if dataLen > 2 {
body = data[2]
}
if dataLen > 3 {
params = rt.ToValue(data[3])
}
case map[string]any:
// Handling of {method: "GET", url: "https://test.k6.io"}
if _, ok := data["url"]; !ok {
return nil, fmt.Errorf("batch request %v doesn't have a url key", key)
}
reqURL = data["url"]
body = data["body"] // It's fine if it's missing, the map lookup will return
if newMethod, ok := data["method"]; ok {
if method, ok = newMethod.(string); !ok {
return nil, fmt.Errorf("invalid method type '%#v'", newMethod)
}
method = strings.ToUpper(method)
if method == http.MethodGet || method == http.MethodHead {
body = nil
}
}
if p, ok := data["params"]; ok {
params = rt.ToValue(p)
}View on GitHub (pinned to 01ffac6f24)
Solutions
- Add a url property to every object-form entry in the http.batch() array
- Verify the property is spelled exactly 'url' and is not nested inside another object
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at js/modules/k6/http/request.go:579 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/1384cd437f7d0aed.
Report an issue: GitHub.