{"record":{"id":"f7ef253ea767914d","repo":"grafana/k6","slug":"unsupported-responsecallback","errorCode":null,"errorMessage":"unsupported responseCallback","messagePattern":"unsupported responseCallback","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"js/modules/k6/http/request.go","lineNumber":420,"sourceCode":"\t\t\t\t\treturn nil, fmt.Errorf(\"invalid timeout value: %w\", err)\n\t\t\t\t}\n\t\t\t\tresult.Timeout = t\n\t\t\tcase \"throw\":\n\t\t\t\tresult.Throw = params.Get(k).ToBoolean()\n\t\t\tcase \"responseType\":\n\t\t\t\tresponseType, err := httpext.ResponseTypeString(params.Get(k).String())\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tresult.ResponseType = responseType\n\t\t\tcase \"responseCallback\":\n\t\t\t\tv := params.Get(k).Export()\n\t\t\t\tif v == nil {\n\t\t\t\t\tresult.ResponseCallback = nil\n\t\t\t\t} else if c, ok := v.(*expectedStatuses); ok {\n\t\t\t\t\tresult.ResponseCallback = c.match\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unsupported responseCallback\")\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif result.ActiveJar != nil {\n\t\thttpext.SetRequestCookies(result.Req, result.ActiveJar, result.Cookies)\n\t}\n\n\treturn result, nil\n}\n\nfunc (c *Client) prepareBatchArray(requests []any) (\n\t[]httpext.BatchParsedHTTPRequest, []*Response, error,\n) {\n\treqCount := len(requests)\n\tbatchReqs := make([]httpext.BatchParsedHTTPRequest, reqCount)\n\tresults := make([]*Response, reqCount)","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/js/modules/k6/http/request.go#L402-L438","documentation":"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.","triggerScenarios":"Thrown at js/modules/k6/http/request.go:420 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}