{"record":{"id":"34ae5471b762ab5f","repo":"grafana/k6","slug":"both-min-and-max-need-to-be-integers-for-argument","errorCode":null,"errorMessage":"both min and max need to be integers for argument number %d","messagePattern":"both min and max need to be integers for argument number (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"js/modules/k6/http/response_callback.go","lineNumber":71,"sourceCode":"\t}\n\n\terrMsg := \"argument number %d to expectedStatuses was neither an integer nor an object like {min:100, max:329}\"\n\tfor i, arg := range args {\n\t\to := arg.ToObject(rt)\n\t\tif o == nil {\n\t\t\tcommon.Throw(rt, fmt.Errorf(errMsg, i+1))\n\t\t}\n\n\t\tif isInt(arg) {\n\t\t\tresult.exact = append(result.exact, int(o.ToInteger()))\n\t\t} else {\n\t\t\tminValue := o.Get(\"min\")\n\t\t\tmaxValue := o.Get(\"max\")\n\t\t\tif minValue == nil || maxValue == nil {\n\t\t\t\tcommon.Throw(rt, fmt.Errorf(errMsg, i+1))\n\t\t\t}\n\t\t\tif !isInt(minValue) || !isInt(maxValue) {\n\t\t\t\tcommon.Throw(rt, fmt.Errorf(\"both min and max need to be integers for argument number %d\", i+1))\n\t\t\t}\n\n\t\t\tresult.minmax = append(result.minmax, [2]int{int(minValue.ToInteger()), int(maxValue.ToInteger())})\n\t\t}\n\t}\n\treturn &result\n}\n\n// SetResponseCallback sets the responseCallback to the value provided. Supported values are\n// expectedStatuses object or a `null` which means that metrics shouldn't be tagged as failed and\n// `http_req_failed` should not be emitted - the behaviour previous to this\nfunc (c *Client) SetResponseCallback(val sobek.Value) {\n\tif val != nil && !sobek.IsNull(val) {\n\t\t// This is done this way as ExportTo exports functions to empty structs without an error\n\t\tif es, ok := val.Export().(*expectedStatuses); ok {\n\t\t\tc.responseCallback = es.match\n\t\t} else {\n\t\t\tcommon.Throw(","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/js/modules/k6/http/response_callback.go#L53-L89","documentation":"expectedStatuses got an object argument whose min and/or max values are not integers (Number.isInteger check failed). The argument was recognized as a range object, but its bounds are fractional or non-numeric, e.g. {min: 200.5, max: '399'}.","triggerScenarios":"Thrown at js/modules/k6/http/response_callback.go:71 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use whole numbers for both bounds: {min: 200, max: 299}","Pass inclusive ranges as integers, e.g. http.expectedStatuses({min: 200, max: 399})"],"exampleFix":null,"handlingStrategy":"validation","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"}