grafana/k6 · error
unsupported fulfill option
Error message
unsupported fulfill option: '%s'
What it means
The options object passed to route.fulfill() contains a key outside the supported set. Only body, contentType, headers, and status are implemented; any other Playwright-style key (e.g. path, response, json) is explicitly rejected to signal incomplete support. The unsupported key name is echoed with %s.
Solutions
- Restrict fulfill options to {body, contentType, headers, status}
- For a JSON body, pre-stringify it: body: JSON.stringify(obj), contentType: 'application/json'
- To fulfill from a file, read it in the script and pass the contents as body
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/js/modules/k6/browser/browser/route_mapping.go:98 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/999de1a6a5b1145d.
Report an issue: GitHub.
Appendix: source
Thrown at internal/js/modules/k6/browser/browser/route_mapping.go:98
rt := k6ext.Runtime(ctx)
obj := opts.ToObject(rt)
for _, k := range obj.Keys() {
switch k {
case "body":
bytesBody, err := k6common.ToBytes(obj.Get(k).Export())
if err != nil {
return fopts, err
}
fopts.Body = bytesBody
case "contentType":
fopts.ContentType = obj.Get(k).String()
case "headers":
fopts.Headers = parseHeaders(obj.Get(k).ToObject(rt))
case "status":
fopts.Status = obj.Get(k).ToInteger()
// As we don't support all fields that PW supports, we return an error to inform the user
default:
return fopts, fmt.Errorf("unsupported fulfill option: '%s'", k)
}
}
return fopts, nil
}
func parseHeaders(headers *sobek.Object) []common.HTTPHeader {
headersKeys := headers.Keys()
result := make([]common.HTTPHeader, 0, len(headersKeys))
for _, hk := range headersKeys {
value := headers.Get(hk)
// Skip undefined headers
if k6common.IsNullish(value) {
continue
}
result = append(result, common.HTTPHeader{
Name: hk,View on GitHub (pinned to 01ffac6f24)