grafana/k6 · error
unsupported responseCallback
Error message
unsupported responseCallback
What it means
parseRequest saw a non-null 'responseCallback' entry in the per-request params object whose value is not an object produced by http.expectedStatuses. Only null (disable) or an expectedStatuses result are accepted; anything else — a plain function, string, or arbitrary object — hits this guard.
Source
Thrown at js/modules/k6/http/request.go:420
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")
}
}
}
}
if result.ActiveJar != nil {
httpext.SetRequestCookies(result.Req, result.ActiveJar, result.Cookies)
}
return result, nil
}
func (c *Client) prepareBatchArray(requests []any) (
[]httpext.BatchParsedHTTPRequest, []*Response, error,
) {
reqCount := len(requests)
batchReqs := make([]httpext.BatchParsedHTTPRequest, reqCount)
results := make([]*Response, reqCount)View on GitHub (pinned to 01ffac6f24)
Solutions
- Pass the result of http.expectedStatuses(...), e.g. { responseCallback: http.expectedStatuses(200, 300-399) }
- Set responseCallback: null to disable the callback instead of using a function or other value
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at js/modules/k6/http/request.go:420 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/f7ef253ea767914d.
Report an issue: GitHub.